What are the advantages of being religious?
Much would depend on what you have in mind when you refer to someone as "religious." Many religions in the world do not offer their followers an advantage. But since you asked me, I will assume that you are equating Christianity to being religious. In this case, there are numerous advantages.
The writer of Ecclesiastes set out to discover the purpose for man on this earth. In his examination, he considered the advantages and disadvantages to wisdom and folly. "Then I saw that wisdom excels folly as light excels darkness. The wise man's eyes are in his head, but the fool walks in darkness. Yet I myself perceived that the same event happens to them all" (Ecclesiastes 2:13-14) Though wisdom doesn't prevent death, nor is it a barrier to suffering and problems, yet a wise person is better off than the foolish person. A wise person knows where troubles come from and where they lie. While problems can't be prevented, the wise person can take steps to minimize their impact in his life. "Wisdom is good with an inheritance, And profitable to those who see the sun. For wisdom is a defense as money is a defense, But the excellence of knowledge is that wisdom gives life to those who have it" (Ecclesiastes 7:11-12).
The Christian has at his finger tips a book containing the wisdom of God. In it is the knowledge of "all things that pertain to life and godliness" (II Peter 1:3). That knowledge will not prevent bad things from happening to the child of God, but it help the child of God minimize their impact in his life. "Moreover by them Your servant is warned, and in keeping them there is great reward" (Psalm 19:11). In other words, life is better overall for the person striving to live by God's rules than it is for the person who doesn't care about God.
As good parents understand, giving a child anything he wants is not good for the child. Such pampering produces a terror. Thus a parent restrains his child, not because he is being mean, but because he has the best interest of the child at heart. The rules he lays down are to keep the child healthy and out of trouble. The same is true concerning our heavenly Father and ourselves. "Where there is no revelation, the people cast off restraint; but happy is he who keeps the law" (Proverbs 29:18). God's laws are not arbitrary, but exist to guide us into making healthy decisions. "If you know these things, blessed are you if you do them" (John 13:17). "For this is the love of God, that we keep His commandments. And His commandments are not burdensome" (I John 5:3).
Let us take an example used by the apostle Paul. When people decide that there is no God, it allows them to throw off the restraints on their behavior. They think that they are being smart and sophisticated, but Paul warns, "Professing to be wise, they became fools" (Romans 1:22). One of the first things people do is engage in unrestrained sexual behaviors. "Therefore God also gave them up to uncleanness, in the lusts of their hearts, to dishonor their bodies among themselves" (Romans 1:24). Sex is not longer confined to monogamous relations. People enter and exit relationships at will. We are just discovering the tragedies of such actions. Recent studies have "discovered" that people who live together without marriage have a far higher divorce rate if they eventually do marry. Child abuse is noted to be higher when children live with adults who are not their biological parents. Many don't see the need to bother marrying, so marriage rates have been declining. Children are being raised by single parents who cannot be as mindful because they must work to provide for the family. This, in turn, appears to be a contributing factor to delinquent behavior at schools. I could go on and on with the unintended consequences of just this one unrestrained behavior.
But to the Christian, none of this is surprising. God said what would happen: "being filled with all unrighteousness, sexual immorality, wickedness, covetousness, maliciousness; full of envy, murder, strife, deceit, evil-mindedness; they are whisperers, backbiters, haters of God, violent, proud, boasters, inventors of evil things, disobedient to parents, undiscerning, untrustworthy, unloving, unforgiving, unmerciful" (Romans 1:29-31). I look around me in my own country and see that we are proving God to be correct on a daily basis.
God noted, "It is not in man who walks to direct his own steps" (Jeremiah 10:23). Man needs guidance. We need laws. Anarchy never works -- in the political realm, nor in the moral realm.