This paper develops a search model with heterogeneous workers and social networks. High‐ability workers are more productive and have a larger number of professional contacts. Firms can choose between a vacancy in the regular market and a job opening in the referral market. The model predicts that a larger number of social contacts is associated with a larger wage gap between high‐ and low‐ability workers and a larger difference in the unemployment rates. The net welfare gain of referrals is estimated at 1.2%. There are three reasons for the inefficiency of the decentralized equilibrium. First is the traditional search externality described by Hosios. Second, firms share their profits with workers, whereas the social optimum implies that full surplus should be given to firms in the referral market. This inefficiency can be internalized by means of referral subsidies. Third, there is the “pooling inefficiency” in the regular market. If high‐ability workers are sufficiently more productive they impose a positive externality on low‐ability workers and should be rewarded by positive transfers. On the contrary, if productivity differences are small, high‐ability workers achieve unreasonably high wages by referring each other and reduce employment chances of low‐ability workers. In this latter case, high‐ability workers should be penalized. If optimal policy is implemented the net welfare gain of referrals rises up to 1.8%.