If you watch 'The Mists of Avalon', the movie about Avalon, Merlin, King Arthur and the rest if his ilk, you will notice that one of the reasons (the main one) that causes Avalon and magic in the world to disappear is the attrition of the notion of magic by religion.
And if you look at real life you will notice the logic progressions through the ages. First it was pure tribal superstistition (aka flok lore and magic), however once christianity started proliferating in Europe this magic was substituted with Religion and what happened is that what was called good magic was now 'miracles and grace from above' while bad magic became the work of evil and the devil (and by the way it seems superstition through the centuries that can be linked to Christians was actually worse than anything tribal magic and folklore could do ...the Christian brand of superstition, eg witches and views on disease, killed myriads of people).
I guess technology is going to be the new 'religion-magic.' Once technology reaches its true apogee you will notice that religion will start to suffer from attrition once humans start doing what was thought to be the sole ability of God.
Imagine what would happen if all disease can be cured, and food/water shortages are tackled at last (this might seem impossible for now, but a century ago so was flying to the moon). Such an even would seriously erode the role of a deity for most people apart from those who truly see God through unabated faith! the reason is for most people God is in direct correlation to how much they need him, how much they feel they need some 'higher power' to ensure everything is ok. The moment science can take the part of a 'higher power' and tackle the most pressing needs then the 'need' for religion will fall.
In essence it will become like yoga, reflexology and acupuncture! Something that people do, and in large numbers (like yoga) , however something that is done for mundane spirituality, esoteric healing, and internal development ......but not out of worship or spiritual devotion.
To be honest with you if science reaches is true apogee there is a good chance religion could take a serious hit and partly become functionally obsolescent! This is not to say that i think there will be no more church goers! No, there will be many. However they will be split as follows: Church goers who go to church to worship God out of their respective faiths (and mean it) .....and those who go to church out of tradition because their parents go to church. (Actually a survey was done recently that showed most people who go to church and write in questionnaires that they are 'Christian' are only so because their parents were Christian. In essence they are Christians by default but an introspection into their lifestyles would show they are technically not what Christ intended).
Christianity will survive but it will be a schism between a small bunch of 'true christians' and a larger branch of 'default christians.' And religion in general will be come like Yoga ......spirituality distilled. However for this to happen science has to reach its apex (and i know some will say that is not possible ...but again remember a century ago the world was totally different in every strata from what it is today).
This should be quite interesting. I am happy that science is continuing to develop, but i feel sorry for those who find things like cloning 'problematic.' Trust me, there are things coming that will make the debate over cloning seem like child's play!
You could say developments will happen that will take the domain of man to true celestial levels, and once that happens to many the sole prominence of religion will begin to ebb as scientists start doing this that religion insisted for centuries only God can do.
For example just last Thursday i saw a report saying that scientists are re-starting the control of weather that they had tried in the late seventies and early eighties (but failed). Now they say they have the technology and ability to do i, and in the process be able to start a gentle weather alteration to severe climatic changes .....even altering hurricanes. Who knows how long it will take before this becomes a weapon of war? Imagine sending a typhoon to rout out terrorists hiding in the jungles of the Phillipines? The Norse thought only Thor and some of the other Asgardian gods could do that!
Science will become super-science. Religion on the other hand will become one of two things: 1) True faith to a few. 2) Psuedo-faith to the rest in which religion becomes in essence a yogic exercise with priests instead of yogis!