This study develops a model in which heterogeneous commuters choose their residential locations and departure times from home in a closed monocentric city with a bottleneck located at the entrance to the central business district (CBD). We show that commuters sort themselves both temporally and spatially according to their income, value of time, and flexibility at the equilibria with and without an optimal congestion pricing. These two equilibria exhibit fundamentally different properties, indicating that congestion pricing alters the urban spatial structure. We then consider two cases wherein rich commuters are either flexible or inflexible and demonstrate that (a) rich commuters reside farther from the CBD in the former case and closer to the CBD in the latter case; (b) congestion pricing makes cities denser and more compact in the former, whereas it causes cities to become less dense and to expand spatially in the latter; and (c) in both cases, pricing helps rich commuters but hurts poor commuters. We further reveal that although expanding the capacity of the bottleneck generates a Pareto improvement when commuters do not relocate, it can lead to an unbalanced distribution of benefits among commuters: commuters residing closer to the CBD gain, while those residing farther from the CBD lose. This suggests that expanding capacity financed by the revenue from congestion pricing could be regressive in a city where rich commuters are inflexible