1 Corinthians 10:12,13 (KJV)
12 Wherefore let him that thinketh he standeth take heed lest he fall.
13 There hath no temptation taken you but such as is common to man: but God is faithful, who will not suffer you to be tempted above that ye are able; but will with the temptation also make a way to escape, that ye may be able to bear it.
When temptation strikes, think about God and how that sin will quench the Spirit. It is not worth it. So run to the Lord God for safety.