Refocus with praise.
How often have you been tempted to sin when your heart and mind were fully concentrated on worship to the Lord? Praising God takes your focus off of yourself and puts it on God. You may not be strong enough to resist temptation on your own, but as you focus on God, he will inhabit your praise. He will give you the strength to resist and walk away from the temptation. May I suggest Psalm 147 as a good place to start.