What explains the ubiquity and cultural success of prosocial religions? Leading accounts argue that prosocial religions evolved because they help societies grow and promote group cooperation. Yet recent evidence suggests that prosocial religious beliefs are not limited to large societies and might not have strong effects on cooperation. Here, we propose that prosocial religions, including beliefs in moralizing gods, develop because individuals shape supernatural beliefs to achieve their goals in within-group, strategic interactions. People have a fitness interest in controlling others’ cooperation—either to extort benefits from others or to gain reputational benefits for protecting the public good. Moreover, they intuitively infer that other people could be deterred from cheating if they feared supernatural punishment. Thus, people endorse supernatural punishment beliefs to manipulate others into cooperating. Prosocial religions emerge from a dynamic of mutual monitoring, in which each individual, lacking confidence in the cooperativeness of conspecifics, attempts to incentivize their cooperation by endorsing beliefs in supernatural punishment. We show how variants of this incentive structure explain the variety of cultural attractors towards which supernatural punishment converges—including extractive religions that extort benefits from exploited individuals, prosocial religions geared toward mutual benefit, and moralized forms of prosocial religion where belief in moralizing gods is itself a moral duty. We review cross- disciplinary evidence for nine predictions of this account and use it to explain the decline of prosocial religions in modern societies. Prosocial religious beliefs seem endorsed as long as people believe them necessary to ensure other people’s cooperation, regardless of their objective effectiveness in doing so.