In many economic applications of matching, the teams that form compete later in market structures with strategic interactions or with knowledge spillovers. Such post-match competition introduces externalities at the matching stage: a team’s payoff depends not only on their members’ attributes but also on those of other matched teams. This paper develops a large market model of matching with externalities, in which first teams form, and then they compete. We analyze the sorting patterns that ensue under competitive equilibrium as well as their efficiency properties. Our main results show that insights substantially differ from those of the standard model without externalities (Becker (1973)): there can be multiple competitive equilibria with different sorting patterns; both optimal and competitive equilibrium matching can involve randomization; and competitive equilibrium can be inefficient with a matching that can drastically deviate from the optimal one. We also shed light on the economic relevance of our matching model with externalities. We analyze two economic applications that illustrate how our model can rationalize the trend in within- and between-firm inequality, and also the evolution of markups of sectors where firms have market power.