Religion can have many purposes...
First, it can be used as a guide to those who are lost.
Second, it can serve as a tool used for people to escapte reality by believing in a better after life.
Third, it establishes moral codes.
Forth, it can server as a measure for a person's self improvements.
Fifth, it promotes social interaction and creates social stability.
Sixth, it restrains people, in both positive and negative ways:
positive: it makes sure that a person doesn't go too far, too extreme, and too violent...
negative: it limits people's mind. It creates a false (or ture, depends what you believe) sense of hope, future, and certainty over the world in flux.
Seventh, it can serve as a tool for authorities to control the people.
Eighth, it can be used as an excuse for prejudice, persecutions, and other forms of injustice.
Ninth, it can be used for wars.
Tenth, it establishes social/racial/political hierachies.