The primary function of religion isn’t to make you happy. It is to draw you closer to God and make you a better person. In addition, every spiritual writer, every great novelist, every thinker worth their salt knows that sometimes we only become better people through suffering, which anyone who has ever cared about someone else has experienced.
But lots of research has shown that religious people happen to be happier on average anyway. Happiness is a very subjective thing, of course and we can argue about the cause and effect of the link till the cows come home, nevertheless, the research shows what it shows.
The Pew Research Centre for Religion and Public Life has published the results of a major new international survey  in the last few days which asks people to rate their level of happiness and then cross-correlates it with their level of religiosity, from unaffiliated, to active and inactive members of religious groups.
With only few exceptions, the actively religious are the most likely to be “very happy” no matter what the nationality. Culture also clearly plays a very big part. Mexicans, Columbians and Ecuadorans are also the most likely to say they are “very happy” with people from former Soviet states, including Russia, least likely to say so. (Spain is also very close to the bottom, which you would not have predicted having seen the Mexican, Columbian and Ecuadoran scores).
The reported happiness level of religious people has nothing directly to do with the truth or otherwise of religious claims, of course, except to this extent: if religion is true to human nature you would probably expect it to make us happier, on average, even if that is not its primary purpose and is only an unguaranteed side effect.
At the same time, it totally contradicts the accusation that religion is repressive and against human nature and should therefore makes us less happy, on average. Yes, repressive forms of religion exist which over-emphasise self-denial, just as some ideas underemphasise self-denial, which can also lead to unhappiness, but if the general accusation that religion is repressive was true, then this latest survey should not have found such a consistent connection between happiness and religious practice.
PS. A number of years ago, Professor Patricia Casey wrote a paper called ‘The Psycho-Social Benefits of Religious Practice’. It was a study of studies, and the studies in question found a positive link between religious practice and good physical and mental health, among other benefits. The paper can be found here .