It’s not a sin to be tempted. Thoughts can come into your head that are not your thoughts. When you recognize that they are not your thoughts, or thoughts you do not want to have, rebuke them. Tell yourself, no, I’m not going there. Call on Jesus.
God knows that we have an enemy that works daily to take us down. That’s why He gave us a plan to deal with it. Pray that you may not enter into temptation. (Lk 22:40) And do not lead us into temptation, but deliver us from evil. (Mat 6:13)
Prayer protects us. It’s wise to pray up before temptation happens rather than struggle to overcome it when faced with it. The thing about temptation is, it’s usually really tempting! If it’s not, then it’s not a temptation to us. Temptation is something that deep inside, we really want but shouldn’t have.
It takes the presence of God to help us overcome what we know to be wrong. And since we are human, we will face weakness until the day we die. Get into the habit now of praying that you will not face temptation. Prayer is your protection and great wisdom. You don’t have to fail.
Another post on prayer protection: Righteousness Protects Your Heart