Religious affiliation had nearly as strong an effect on longevity as gender does, which is a matter of years of life.
Religious people may live on average four years longer compared to their atheist peers, a study of obituaries in the US has found.
The four-year boost - found in an analysis of more than 1,000 obits from around the US - was calculated after taking into account the sex and marital status of those who died, two factors that have strong effects on lifespan.
"Religious affiliation had nearly as strong an effect on longevity as gender does, which is a matter of years of life," said Laura Wallace, a doctoral student at The Ohio State University in the US.
The study, published in the journal Social Psychological and Personality Science, found that part of the reason for the boost in longevity came from the fact that many religiously affiliated people also volunteered and belonged to social organisations, which previous research has linked to living longer.
"The study provides persuasive evidence that there is a relationship between religious participation and how long a person lives, said Baldwin Way, an associate professor at Ohio State.
The study also showed how the effects of religion on longevity might depend in part on the personality and average religiosity of the cities where people live, Way said.
The first study involved 505 obituaries published in the Des Moines Register in January and February 2012.
In addition to noting the age and any religious affiliation of those who died, the researchers also documented sex, marital status and the number of social and volunteer activities listed.
Results showed that those whose obit listed a religious affiliation lived 9.45 years longer than those who did not. The gap shrunk to 6.48 years after gender and marital status were taken into account.
The second study included 1,096 obituaries from 42 major cities in the US published on newspaper websites between August 2010 and August 2011.
In this study, people whose obits mentioned a religious affiliation lived an average of 5.64 years longer than those whose obits did not, which shrunk to 3.82 years after gender and marital status were considered.
Many studies have shown that people who volunteer and participate in social groups tend to live longer than others.
The researchers combined data from both studies to see if the volunteer and social opportunities that religious groups offer might explain the longevity boost.
Results showed that this was only part of the reason why religious people lived longer.
"We found that volunteerism and involvement in social organisations only accounted for a little less than one year of the longevity boost that religious affiliation provided," Wallace said.
"There is still a lot of the benefit of religious affiliation that this can't explain," Wallace said.
It may be related to the rules and norms of many religions that restrict unhealthy practices such as alcohol and drug use and having sex with many partners, Way said.
"Many religions promote stress-reducing practices that may improve health, such as gratitude, prayer or meditation," he said.
The fact that the researchers had data from many cities also allowed them to investigate whether the level of religiosity in a city and a city's "personality" could affect how religious affiliation influenced longevity.
The findings showed that a key personality element related to longevity in each city was the importance placed on conformity to community values and norms.
In highly religious cities where conformity was important, religious people tended to live longer than non-religious people.