It should be noted that natural selection does not favor the one who lives longest- it favors the one who has the most babies. From this standpoint the common religious mandate to chastity could be viewed as slightly maladaptive. Living longer does not increase your Darwinian fitness, and may in fact decrease it if you take up resources that otherwise would go to your descendents.
However, if you also look at natural selection as acting upon groups rather than just individuals (as it does) you can see that a religious society would have greater order, with its mandates restraining the impulses of fools, and so the society could grow to be more successful than others. I take the view of theistic evolution, as did Newton, viewing God as the great clockmaker who established the rules by which this world runs and then letting it tick along.
Of course, no clock keeps perfect time, and sometimes He has to step in to reset His clock. 
_________________
WAR IS PEACE
FREEDOM IS SLAVERY
IGNORANCE IS STRENGTH