If you're wondering what your city's limits are, check your city's website and look up animal codes. Our city limit is 5 dogs & 3 cats (or 10 if confined w/in a structure).
My ideal # for an apartment was 2 cats - I ended up w/4 b/c a stray had a litter under my porch, and I couldn't find homes for all of the kittens, so I ended up keeping 2. Right now, living in a house, we have 3 indoor-only cats, 1 indoor-outdoor cat, 1 outdoor-only feral cat, 2 dogs, and 1 stray puppy who needs a home. I think we're at our limit, especially since we're planning to start a human family soon.
I would be afraid to have more, because with an increased number of pets sometimes there is an increase in behavior problems associated with crowding. Also, if an animal (or multiple animals) become(s) ill, I'd need to have the time, energy, and money for extra care. Think about ordinary chores like tooth-brushing, bathing, brushing, ear-cleaning, feeding, walking, litterbox cleaning, poop-scooping, socializing, training, etc. and multiply!
When I took on my pets, I made a commitment to care for them to the best of my ability - I feel that taking on another pet would take away from the ones I've already commited to caring for. But that's just me. If you can provide space, attention, and veterinary care to a larger number, that's wonderful.
Also, with a limited number of permanent pets, we do have space to save & foster the occasional stray that comes along until we can find him/her a home.