We propose a way to model firm mergers using a matching game known as the roommate problem, whereby firms are assumed to make preference rankings of potential merger partners. The position of a firm in another firm's ranking is assumed to be governed by an index, which in turn consists of a deterministic part and of a stochastic one, similar to the latent indices used in standard discrete-choice models. Given all firms' preferences, game-theoretic mechanisms lead to a matching whereby each firm is either self-matched or assigned a merger partner. We derive expressions for the probability of a merger between a specific firm pair, and also a log-likelihood function for estimation using firm-specific data. Using a simulation in a setting with groups of three firms involved in roommate games within each group, the model's finite-sample properties are examined.