We develop a multi-sector spatial equilibrium model with endogenous land use: land is used either for agriculture or housing. Urban land, densely populated due to commuting frictions, expands out of agricultural land. With rising productivity, the reallocation of workers away from agriculture frees up land for cities to expand, limiting the increase in land values despite higher income and increasing urban population. Due to the reallocation of land use, the area of cities expands at a fast rate and urban density persistently declines, as in the data over a long period. As structural change slows down, cities sprawl less and land values start increasing at a fast rate, as in the last decades. Our theory can thus match the joint evolution of population density and land values across time and space, matching historical data assembled for France over 150 years.