Licensing in a patent thicket allows firms to either avoid or resolve hold-up. Firms’ R&D incentives depend on whether they license ex ante or ex post. We develop a model of a patent portfolio race, which allows for endogenous R&D efforts, to study firms’ choice between ex ante and ex post licensing. The model shows that firms’ relationships in product markets and technology space jointly determine the type of licensing contract chosen. In particular, product market competitors are more likely to avoid patent portfolio races, since the threat of hold-up increases. On the other hand, more valuable technologies are more likely to give rise to patent portfolio races. We also discuss the welfare implications of these results.