Social science research has stressed the important role of religion in sustaining cooperation among non-kin. We contribute to this multidisciplinary literature with a large-scale empirical study documenting the relationship between religion and cooperation. We analyze newly available, experimentally validated, and globally representative data on social preferences and world religions (Christianity, Islam, Hinduism, Buddhism and Judaism). We find that individuals who report believing in such religions exhibit more prosocial preferences, as measured by their levels of positive reciprocity, altruism and trust. We further document heterogeneous patterns of negative reciprocity and punishment—two key elements for cooperation—across world religions. The association between religion and prosocial preferences is stronger in more populous societies and weaker in countries with better formal institutions. The interactive results between these variables point again towards the substitutability between religious and secular institutions, when it comes to sustaining cooperation.