There is no place in the Bible that forbids men and women from being friends with each other. Friendships with the opposite sex are acceptable, even beneficial, within proper boundaries. But boundaries are necessary. Many people who have affairs would never have anticipated cheating on their spouses, but it still happened. Why? Because there were not proper boundaries in place. Married spouses should have mutually agreed upon boundaries that will protect their relationship and maintain their mutual trust.
When times in the marriage are good, it's easy to maintain external opposite sex friendships because you are feeling more fulfilled by your spouse. However, when times get tough in a marriage, it can become a temptation to develop unhealthy emotional attachments, if not physical ones. Friendships require emotional investment, which is enriching and important; however, we have to be wise about with whom we form close emotional bonds. If a woman has a male best friend, not her spouse, she will most likely want to go to him as a confidant, advisor, and source of support when times are tough. The same is true for a man with a close female friend.
When a spouse is distant (physically or emotionally) and we have another friend of the opposite sex, it can be tempting to fill in the gaps of what is missing with our spouse with that person, which can lead to those classic "in love" feelings. As tough as it may be, it is a wiser choice to communicate directly with your spouse when you are having struggles rather than seeking comfort from another. Consider the question, "Is this friend meeting a need for me that my spouse is a more appropriate person for?"
Married men and women should do their best to avoid any potentially compromising situations or relationship dynamics with friends of the opposite sex. They must develop healthy boundaries that work for both the husband and wife. And overall, both the husband and wife must invest in their marriage, communicating, growing, and loving well together.