We introduce a new model for the evolution of networks of firms exchanging knowledge in R&D partnerships. Innovation is assumed to result from the recombination of knowledge among firms in an R&D intensive industry. The decision of two firms to establish a new partnerships or to terminate an existing one, is based on their marginal revenues and costs, which in turn depend on the position they occupy in the network. Moreover, the formation of a collaboration has significant external effects on the other firms in the same connected component of the network. We show that this decentralized partner selection process leads to the existence of multiple equilibrium structures. Finally, by means of computer simulations, we study the properties of the emerging equilibrium networks and we show that they reproduce the stylized facts of R&D networks.