Social services provided by governments and secular agencies have created a system whereby religion has lost much of its influence. Economic development, jobs, financial security have also resulted in the lessening of religion's influence.
The growth of other charitable causes, clubs, organizations, etc. has removed the need to bind together in a pointy (or round) topped building in order to fellowship and commiserate.
The widespread availability of education, especially higher eduction, which (well supposedly) teaches people how to think critically and evaluate and analyze data empirically greatly lessens religion's influence.
Birth control, antibiotics, advancements in medical treatments/pharmaceuticals have also lessened religion's influence. In many areas women can act like men have for thousands of years ant not fear pregnancy, for example (and thank god for that!).
The social evolution of industrialized societies includes an acceptance of gays, transgenders, living together and having sex without marriage, birth control, etc. without the condemnation imposed by religion. Religion is quickly losing its grip as a result.
That leaves one thing - a belief in a here-after. The more rational we become that will also fade. That belief isn't based on anything that is rational; there are so many differing beliefs regarding the afterlife that to think any of them are relevant is sticking one's head up one's ass and continuing to believe simply because one wants to believe.
Whether there is an afterlife, religion has nothing, I repeat NOTHING, to do with it. Once humans understand this, religion will lose its final influence. The only places religion will continue to flourish are those areas or religions that do not include one or more of the above mentioned factors.
Educated priests and religious leaders and ministers know this. Google the following article.
The End of Religion as We Know It: Why Churches Can No Longer Hide the Truth
Daniel Dennett on closeted atheist clergy and our new age of radical transparency.
May 16, 2015