I suffer from OCD. In the past, especially when I was in my late teens and early 20's, the condition was downright crippling. I couldn't leave my room for hours on end, barely slept, and led a private life of not-so-quiet desperation (I yelled at myself A LOT). One of my compulsions was finding a benign program on which to shut off the TV at night. The show had to have nothing negative in it, nothing I considered upsetting or unsettling. Of course, in my OCD-brain, nothing fit that criteria. I was able to glean something negative and unsettling from a TV test-signal, let alone the rest of the garbage on late-night TV. Sufficed to say, I stayed up until the wee hours of the early morning, surfing through the channels, looking for something, anything, that would allow me to turn off the TV and go to bed. More than once, I simply passed out from exhaustion.
Anyway, I finally admitted my problem and went for therapy. I also went on Zoloft, which I think really did the trick. A therapist I was seeing also made this recommendation to me, which I think lends itself well to any form of compulsion (lust, included): run away. If you find yourself in an environment that is fostering some compulsive activity -- in front of a TV late at night, in a dark room with a laptop, etc. -- literally, get up, and RUN out of there. He emphasized the running part, as silly as it may seem. In my mind it was almost like pulling off a Band-aid, or pulling the lever on a jet-fighter ejector seat: dramatic, fast and effective. RUN AWAY.
Now, this doesn't mean run away in the metaphorical sense, as in, running from your problems. Those have to be addressed very directly. Rather, it means that if you find yourself in the heat of the act, in the grips of compulsion, a dramatic escape might just do the trick. So much of addiction is centered on the act itself. Heroin addicts present physiological addiction symptoms from seeing images of needles. As lust addicts, we have our own set of banal triggers.
So, if you have the precious presence of mind to see yourself acting out, RUNNING out of the room, as simple and silly as it sounds, might be enough to avoid that particular misstep. It's worked for me in my OCD, and I'm planning on trying it with my lust compulsions as well.