There has been a lot of research recently into the links between religion and mental health. Researchers at Temple University in the U.S. studied 918 people and looked into three aspects of religious belief: church attendance, religious well-being (the quality of a person's relationship with a higher power) and existential well-being, a person's sense of meaning and their purpose in life. People with high levels of religious well-being were 1.5 times more likely to have had depression than those with lower levels of religious well-being. However, people who attended church regularly were 30% less likely to have had depression in their lifetime and people who had a clear sense of meaning and purpose in their life were 70% less likely to have suffered from depression.
You can find out more about this research at