This paper presents a new equilibrium framework for analyzing economic and policy questions related to the sorting of households within a large metropolitan area. We estimate the model using restricted-access Census data that precisely characterize residential and employment locations for households the San Francisco Bay Area, yielding accurate measures of preferences for a wide variety of housing and neighborhood attributes across different types of household. We use these estimates to explore the causes and consequences of racial segregation in general equilibrium. Our results indicate that, given the preference structure of households in the Bay Area, the elimination of racial differences in income and wealth would significantly increase the residential segregation of each major racial group, as the equalization of income leads, for example, to the formation of new wealthy, segregated Black and Hispanic neighborhoods. We also provide evidence that sorting on the basis of race itself (whether driven by preferences or discrimination) leads to large reductions in the consumption of housing, public safety, and school quality by Black and Hispanic households.