I originally found and got this tool from John Piper. As I have found it useful, I put it here for your use as well. It can be used in far more situations that simply against sexual sin and also sets up a habit for right thinking.
APTAT
Admit you can do nothing without God (John 15:5)
Pray for help (Psalm 50:15)
Trust a specific promise (2 Chronicles 20:20)
Act (Philippians 2:12-13)
Thank God for His provision and goodness (Psalm 106:1)
Use the above link on John Piper’s name to see more from Desiring God ministries or click here.