I think this thread is ignoring the correlation between religion and unsuccessful societies due to economic inequality. Basically the more wealthy a society is, with the wealth spread out further across the population, the less religious that society tends to be. Because religion, to an extent, is a psychological coping mechanism - the more anxious you are about your daily life, the more likely it will be that you will look to find something, or someone, to help ease that burden.
So, really, the only reason that I can see for wanting to retain a religion in order to keep society stable would be if you prefer society to be unequal and to have large portions of it living in poverty. In those instances religion can be a useful tool to keep the peace in groups of people living under stressful circumstances. But even that isn't surefire, and actually many of the more religious areas of the world are also very dangerous places to live in general, so clearly it isn't a perfect strategy by a long stretch!
If the aim is to keep society stable and peaceful, really religion isn't the thing to be concentrating on, or even concerned with - it's wealth, and more particularly getting rid of wealth inequality. Religion will probably dissipate along with the wealth gap, but society on the whole won't need it because people will be happier, and happier people don't need as much of a crutch to just get on with the day.
It reminds me of a comedian I saw once who pointed out - you never hear of someone finding god when everything's going well for them; you'll hear someone say 'my dog died, my car blew up, I lost my job and my house, but I've found god, so that's ok'; but it's much less likely you'll ever hear 'i got married, got my dream job, won the lottery, oh, and I also found god'!