I’ve said it before but will say it again: frequenting the sacraments aside, the best remedy for sin, particularly sexual sin, is to get busy doing good stuff and staying too busy to sin.
The idea isn’t to create a void (“I must not think about X, I must not think about X,”), but to fill your mind with more important, productive stuff.
Every single day:
–Go to work (or school, if you’re a student, plus studying). On your days off, have another job to do–build stuff for Habitat for Humanity, volunteer at the soup kitchen, take a plumbing class, whatever. If you have debt, get a second job to pay it off.
–Work out. Hard. Walk, swim, box, play a sport, whatever you enjoy, or at least tolerate. Lift weights.
–Practice self-control in other areas by eating well and drinking moderately, which trains your mind like a workout trains your body. Similarly, keep a reasonably clean living area.
–Find someone who needs your help, and give it to them. Call grandma, buy that homeless guy a meal, even just pet the adoptable cats at Petco for a couple of minutes.
–Talk to other people, whether roommates, family, or friends.
–Pray and read scripture.
Basically, your (in the generic, not specific, sense–I include myself in this!) enemies are loneliness, boredom, and lack of discipline/structure, so don’t let them take root. If you do all of the above, I think you’ll just plain find yourself too busy and focused most of the time to sin, plus, when the temptation crops up, it’ll be easier to say “no.”