Should regulators encourage the migration of trade from over-the-counter (OTC) to centralized markets? To address this question, we consider a model of equilibrium and socially optimal market participation of heterogeneous banks in an OTC market, in a centralized market, or in both markets at the same time. We find that banks have the strongest private incentives to participate in the OTC market if they have the lowest risk-sharing needs and highest ability to take large positions. These banks endogenously assume the role of OTC market dealers. Other banks, with relatively higher risk-sharing needs and lower ability to take large positions, lie at the margin: they are indifferent between the centralized market and the OTC market, where they endogenously assume the role of customers. We show that more customer bank participation in the centralized market can be welfare improving only if banks are mostly heterogeneous in their ability to take large positions in the OTC market, and if participation costs induce banks to trade exclusively in one market. Empirical evidence suggests that these conditions for a welfare improvement are met.