However many you need.
For what it's worth, I personally use levels 0-60 for main levels (with the patch to move overworld levels 101-13B to 25-5F), I use levels 61-FF for additional main rooms, and I use levels 100-1FF for bonus rooms. The titlescreen and intro are usually levels FE and FF, debug levels can either be near there (say, FA-FD) or in 100-1FF, and many of the late 1xx levels I use as templates for different graphics sets.
As for how many can fit in a ROM, it's kind of a moot point because SMW normally only supports 512 sublevels anyway, and adding custom code to have more than that would likely break compatibility with Lunar Magic. If you were willing to do that, though, you'd only be limited by how many bytes each sublevel used and how much other stuff was in the ROM.
I'm working on a hack! Check it out here