We find that per capita municipal spending on public services is strongly and non-linearly correlated to urban population density. Optimal expenditure levels for municipal services are achieved with densities close to 9000 residents per square kilometre. In our study of about 8600 municipalities of Brazil, Chile, Ecuador and Mexico, 85% of all municipalities are below this ideal density level. This result provides strong policy support for densification, particularly in medium-sized cities of developing countries, which are currently absorbing most of the world’s urban population growth.