1 Corinthians 6:18-20
Flee immorality. Every other sin that a man commits is outside the body, but the immoral man sins against his own body. Or do you not know that your body is a temple of the Holy Spirit who is in you, whom you have from God, and that you are not your own? For you have been bought with a price: therefore glorify God in your body.
The best way to overcome sexual temptation is to physically remove yourself from the situation where you are being tempted!
The Bible makes it so very clear that your sexual purity is one of the crucial issues in your relationship with God. Allow yourself to dishonor God in your sexuality, and there'll be massive problems in your walk with Him. God will forgive sexual sin in your life when you turn to Him in repentance. But the goal of life is not daily forgiveness, but daily victory!
So, how do we find victory over sexual sin in our lives, whether it is sin of the mind or of the body? "Flee immorality." Notice that it does not say, "Fight immorality!" If you leave yourself in that tempting situation and try to fight it, you may as well give up!
It's worth turning off the TV, leaving the beach, moving to another city, changing your job, finding another hobby—whatever it takes—to remove yourself from the source of sexual temptation.