A question central to R&D policy making is the impact of competition on cooperation. This paper builds a theoretical foundation for the dynamics of knowledge sharing in private industry. We model an uncertain research process and ask how the incentives to license intermediate steps to rivals change over time as the research project approaches maturity. Such a dynamic approach allows us to analyze the interaction between how close the firms are to product market competition and how intense that competition is. We uncover a basic dynamic of sharing such that firms are less likely to share as they approach the product market. This dynamic is driven by a trade-off between three effects: the rivalry effect, the duplication effect and the speed effect. We show that this dynamic can be reversed when duopoly profits are sufficiently low or when the firms have asymmetric research capabilities. We also explore the implications of the model for patent policy, and compare policies targeting early research outcomes with policies targeting late research outcomes.