Your ranking is based on the working population in your city, the amount of base culture points that are required and the number of encounters you have solved on the map. So building things in the city, especially things that require working population like manufactories, and solving encounters on the world map are the way to increase your points and get a better rank.
In terms of balancing population with required residences, one thing that I do is avoid upgrading the barracks a lot, since it requires a lot of population. That will mean you will produce military units more slowly, but this is not a problem if you are online several times during the day to reset builds.
Another thing is to seriously consider how many workshops you need and how many manufactories of each type. Doing the "cycle" quests for gold and resource points can reduce the number of workshops you need.