I know this may only work if you are already well on the road of recovery, but a friend suggested that whenever you're in a place of possible triggers, listen to the song תנה בני from Motty Steinmetz.
The Lyrics are :-
תנה בני לבך
תנה בני לבך לי, תנה בני
ועיניך דרכי תיצורנה
ועיניך דרכי תיצורנה
אמר הקב״ה
אי יהבית לי ליבך ועיניך
אנא ידעית דאת דילי
Which mean "My son, give me your heart and with your eyes guard My ways" - says הקב״ה "If you give me your heart and your eyes I know you are Mine"
This is from the ירושלמי.
When I listen to this very moving song, I imagine Hashem crying out to me - My dear son, please give ME your heart and eyes, (i.e. dont look at places and don't fantasize about things you shouldn't) and then you will be Mine!
Who can refuse such a cry from Hashem!