Having a love affair with your wife or your husband, exclusively and throughout your life, insures sexual purity. That one-man-one-woman relationship, enjoying all of the aspects of one another, binds you together and guards your relationship. Here are a couple more safeguards to protect you from an affair.
Number one, don't give yourself the opportunity. Proverbs 5:7-8 says, "Therefore hear me now, my children, and do not depart from the words of my mouth. Remove your way far from her [the immoral woman] and do not go near the door of her house." Notice, it doesn't say, "Don't walk in the door" or "Don't go up to it," but "Don't even go near it." In other words, go out of your way to avoid temptation.
Be careful not to go near the "door" of pornography, or certain movies, books, websites, etc. Be careful, too, about relationships that might tempt you. Some people will attract you more than others, and you know who they are when you meet them. So watch that as well.
Be careful with your eyes especially. Jesus said, "You have heard that it was said by those of old, 'You shall not commit adultery.' But I say to you that whoever looks at a woman to lust for her has already committed adultery with her in his heart" (Matthew 5:27-28). The word for "look" is not the inadvertent glance. It's the steady, continuous gaze, looking with the intention of lusting. Stay away from that path, that opportunity.
A case in point is King David, who saw a naked woman one night (see 2 Samuel 11). He couldn't help the first look, but he could have helped that double-take. Instead of turning away, he let his mind play with it, and he called for her, and they had sex together.
Along with that, be careful with your mind. Some so-called sex experts tell people that sexual fantasies are okay, that "you're not hurting anybody because it's only in the mind." Wrong! The mind is the battleground, and the battle is won or lost there. If you imagine being with someone sexually and you keep fueling those thoughts, it can eventually become a reality. I've counseled people who have confessed that, and studies confirm it.
Secondly, live under the accountability of God. "For the ways of man are before the eyes of the Lord and He ponders all of his paths" (Proverbs 5:21). Purity begins with a commitment to God, even before an agreement with your spouse or with yourself. It begins with living under the all-seeing eye of God, with the fear of the Lord, which is the beginning of wisdom and knowledge (see Proverbs 9:10). If you realize that wherever you go, whatever you see or do, God is watching and pondering, it can make all the difference.
We should always consider Jesus Christ in all our relationships and press forward toward the goal of being like Him. Purity begins by pleasing God, realizing that we are His property, His temple, and that He lives within us. We have been bought by the blood of Jesus Christ, and we should live differently.
We should live as holy men and women, under the eye of God, set apart for His work. We should stay far away from immoral paths, away from the doors that would open to behaviors that would ensnare us.