This paper introduces a structural model for the coevolution of networks and behavior. We characterize the equilibrium of the underlying game and adopt the Bayesian Double Metropolis-Hastings algorithm to estimate the model. We further extend the model to incorporate unobserved heterogeneity and show that ignoring unobserved heterogeneity can lead to biased estimates in simulation experiments. We apply the model to study R&D investment and collaboration decisions in the chemical and pharmaceutical industry and find a positive knowledge spillover effect. Our model also provides a tractable framework for a long-run key player analysis.