When a temptation first presents itself, a good way to respond is to memorize and recite a power prayer.
A power prayer is one that you have down by heart, is short, and is specifically formulated to be helpful to you when tempted.
I use: "Jesus, Mary, and Joseph, assist me!"
And also: "Lord, I pray for the grace to respect and protect all your daughters."
Or, "Lord, I praise you for the beauty of all your daughters, including this one, but especially for the beauty of my wife."
When evil thoughts arise: "I reject these evils thoughts utterly."
One of my favorites: "I desire to give myself to my wife alone."
When I see a scantily clad woman that I'm attracted to and feel a temptation to lust coming on, I say one of these prayers.
Come up with a few power prayers and start reciting them when tempted.
You may need to try out several. Or, some may work for a time but then you need to mix things up and use new ones.
These prayers are not magical. If they don't work sometimes, that is okay. It is one more tool in your toolbox. One more way that you call to mind the truth of God and how we made us.
Eventually, lust loses its luster.
I can tell you from experience that, after practicing these things for years, and learning about the theology of the body, when I did fall to temptation, it was not as satisfying as it once was.
In fact, it became so banal and trite. So fleeting, and then made me feel so sick that I wondered why I was falling for this sham that fell far short of real love.
I didn't conjure up those feelings of dreariness with lust. God led me to it when the time was right. And He will for you too, as you continue fighting to grow strong in purity.
Do not give up! He is with you.
"It is necessary to be strong, in order to become great; that is our duty. Life is a struggle, which we cannot avoid. We must triumph!"
- St. Padre Pio