You should only attack another civ if it is better than not attacking, and only keep a city if it is better than not keeping it. If a city is going to cost too much, and isn't going to contribute any time soon, better to raze it. If your economy isn't really ready to expand, you don't need more cities.
Sometimes you need to go to war and invade even when you can't keep cities. You may need to weaken an aggressive neighbor while you have an advantage, or kill a civ so you can later use their land.
One thing you could do is only keep enemy cities if they are in really key spots, or if they have high enough population to whip a courthouse (takes a size 8 city with a turn of production on it IIRC). High production cities should be kept because they can usually offset the maintenance temporarily by running wealth (one of the reasons currency is so important for large scale expansion). After the war is over, you can keep slavery for a while to try to whip some courthouses, and then switch to caste system ... then you can run merchant specialiasts to help out.
You should also remember that city maintenance has 2 components: distance from capital, and # of cities. Adding a city increases maintenance in all your cities. So don't keep that junky city in the desert that will never be worth anything, or even small cities that will take forever to contribute. You can usually just resettle the land later.
Also consider shorter wars, keeping only 1 or 2 cities at a time, then develop your economy, then another war.