As your city is so vast it is like an empire within an empire. I think you look at how ancient empires maintained control. Intelligence and soft power would be used a lot. They often controlled the courier or primitive 'postal' network which doubled as spies. This city would obviously need some courier network. You have already mentioned that the army is essentially royal or imperial, and that is under the direct command of the ruler.
You would want to keep the army happy like dictators do, but also diffuse their power a bit so you would want to keep different generals in competition with each other over various sectors of the city.
Strong centralized empires and rulers who want to maintain tight control directly appoint officials. This bypasses nobility and insures you have direct line of authority. So you would want your ruler to directly appoint your own governors or various district leaders.
Since this is a city, then you would maintain centralized control, especially of critical infrastructure. This is typically expressed in different settings by the central government having tight control over food, water, electricity, and basic resources. This is also how dictators maintain control. Your ruler would have absolute control of the critical infrastructure of the city and could cut power as well as other needs. 222
You may also have tight control of surveillance if that technology exists, but if not then you would use couriers as well as spies among the population. Agents who are handlers can handle multiple informants, and a whole network of informants can be created.
Your king should control trade and commerce. Minting coins and currency would be under the control of your king. That way the coinage would reach all sectors of the city. All other currency would be suppressed.
Gateways between districts of the city and control of passage would also be important. Your king's government would control trade, taxation, and passage between sectors of the city.
Your king and his spymaster among others would be skilled in learning the informal networks of power in the city. That is who are the more prominent citizens, merchants, neighborhood leaders, elders, and others in each neighborhood of the city. You would make sure that your government and governors kept close track of these informal leaders. You could even institute a type of millet system for various ethnic groups if there are particular areas of the city where they reside and if they demand to be governed by their law.
Sci-fi often depicts governance over small cramped domains in space. The series Battlestar Galactica shows what control and rebellion in a small tight space look like as early on the government is primarily governing a few cramped ships. Babylon 5 also depicts a government over a confined space. Control of critical infrastructure is often a theme. 159