There is no reason why humans would evolve to think logically. Humans are definitely pattern matching animals which is a low effort method of making sense of the world. It is efficient and it often works well. This is particularly true for hunter gatherers when it is necessary for survival to figure out the patters in the seasons, vegetation yields, migration patterns of animals, etc.
Religious thinking and magical thinking may also have an evolutionary advantage. Because natural selection favors those who are able to adapt and cope with their environment then the ability to find some plausible explanation for hardships can be adaptive. Stated directly, the people who get depressed and give up are going to starve to death. However those that exhibit hope and perhaps faith may be more inclined to press forward and thus are more likely to survive.
Chimps do not have sufficient neural matter to think in the abstract ways required for religious belief. However chimps, dogs, cats, mice, etc can exhibit superstitious learning. This is a result of the pattern matching nature of all animals. When a stimulus and response are linked via some other mechanism or happen at a high enough frequency separately that they appear to be connected superstitious learning can take place.
A belief system does not necessarily need to be true or necessarily based in reality to be advantageous. Religion seems to fall into this category. Religion seems to fail all logical tests but it helped to cement communities together which had survival advantages and as mentioned above it provided hope in the face of daunting challenges. There are some negative side effects when the hope and faith placed in a deity leave the person in a dangerous situation that they should rightly escape. However our planet and our interactions with our environment are complex enough that a degree of erroneous decision making is not catastrophic or necessarily harmful in many instances.
So on question might be what role should religion play including what level of commitment, and what particular belief system or systems are adaptive? It really depends on the state of the world at any given point in time. I think it also depends on the belief system. Fundamentalist belief systems often lead to intolerance and destructive behavior. I am not convinced there is any perfect balance between believers and non-believers percentage wise at any given time either. Even in our modern world where religion is not so essential for dealing with troubles the more liberal faiths seem to provide benefits for many people. We have yet to fully address all of the challenges facing society (i.e. poverty, illness) thus there is often a role for the support and hope that can be provided by religion. Atheism and agnosticism are more logical but can be difficult positions to hold when faced with a serious illness or the death of a close friend or family member. Some people have the emotional resources to cope sans religion and others not.
There is also the issue of societies regressing as well as progressing. During the stable and advanced states of ancient civilizations such as Rome, Greece, Egypt, and Persia the religious tenor seemed to be more liberal and somewhat on a par with liberal mainstream Protestants, liberal Judaism, etc in terms of acceptance of others and general lack of dogmatism. Definitely differences but overall rather liberal in comparison to some of the surrounding societies. When each of these societies slipped back into a more primitive state it seems that religion regained a state of importance and level of interpretation fitting to the society.
A more fundamentalist approach likely created survival advantages in situations where there were not enough resources to feed and shelter two separate populations for instance. The moral issue is important but from a pure issue of survival defense of the in group at the expense of the out group resulted in the survival advantage. I am not convinced that we have seen such a situation in the last several centuries although we as a species continue to act in many instances like that is the case.
So a short answer would be it really depends on each individual's current internal and external state in addition to the general state of the society. It also depends on the belief system in question and the level of adherence to the given belief system.