The obvious answer is to build and upgrade farms. As you said, you can also farm NPCs and other player's cities. In addition, food is probably the cheapest resource on the market, so you can sell lumber or iron for a profit and buy food. Owning a lot of high-level valleys can help. Lakes give the most food bonus, then swamps, then grasslands.
From what I have seen from the more-seasoned players, to own a lot of troops will always mean that you are negative in food production. They upkeep their troops by farming NPCs.
"I am the terror that flaps in the night! I am the stink bug that smears your windshield. I am Lightfoot Duck!"