In tightly coupled socioecological systems, such as cities, the interactions between socio-economic and biophysical characteristics of an area strongly influence ecosystem function. Very often the effects of socioeconomic activities on ecosystem function are unintended, but can impact the sustainability of a city and can have irreversible effects. The food system in its entirety, from production to treatment of human waste, is one of the most important contributors to the way phosphorus (P) cycles through cities. In this article we examined the changes in P dynamics at the urban–agricultural interface of the Phoenix, Arizona, USA, metropolitan area between 1978 and 2008. We found that the contribution of cotton to harvested P decreased while the contribution of alfalfa, which is used as feed for local dairy cows, increased over the study period. This change in cropping pattern was accompanied by growth in the dairy industry and increased internal recycling of P due to dairy cow manure application to alfalfa fields and the local recycling of biosolids and treated wastewater. The proximity of urban populations with dairies and feed production and low runoff in this arid climate have facilitated this serendipitous recycling. Currently P is not strongly regulated or intentionally managed in this system, but farmers' behaviors, shaped largely by market forces and policies related to water recycling, unintentionally affect P cycling. This underscores the need to move from unintentional to deliberate and holistic management of P dynamics through collaborations between practitioners and researchers in order to enhance urban sustainability.