Realize the effect masturbating has. This will be different for every person.
For me, immediately I’m high, drunk, lost inside myself. Self-pleasure is mine, mine, mine. It leads me to sexualise every person that crosses my path. No longer are they human, they’re walking god’s, there to please me. That thinking leads me to feel so disconnected from the world. I end up with even more pain (which I only know how to deal with in one way). However good it felt in the moment means nothing when the next day I’m bashing myself for losing it yet again. I feel two-faced, lying to the world. I realize what acting out does to me. I cannot afford to go back to that place because it will lead me to dangerous acts, eventually with my life on the line.
TaPHSiC method
This comes BEFORE acting out. It’s a preventative action. Alone, it is not enough to stop me acting out, but it definitely makes it that much harder to fall; knowing the price probably isn’t worth the few seconds of climaxing. Read more about it here, it just might be what works for you. On similar lines, making a list of things that I would try and keeping it on hand with a commitment to try some before acting out has been super helpful for me. (I have a list if you want!!)
Commit to 24 hours
We’re not talking about a lifetime. We’re not even talking about a week. We’re talking 24 hours. That’s it. Afterwards, there is no certainty. I may even end up acting out. But I can hold off for 24. Every day I have to recommit. It’s one of the most helpful things that gets me through.
Recognize triggers, followed by action.
Triggers for me include being hungry, angry, lonely or afraid (or plain bored!). There are many actions I have to take in order to stay sober. Mostly it’s about doing something different. When under attack, I have to cross roads, look away, keep my hands occupied, take cold showers, get out of bed (even if it’s the middle of the night), call someone, squeeze a pillow, go for a run, anything to get myself out of that moment. Once I’ve changed my actions, the power the desire has over me is significantly weakened. It’s hard, but almost foolproof.
Daven
I ask Hashem to take away the lies I tell myself; that I can start and don’t have to finish, that just one time won't make a difference, it’s not against the Torah, everybody does it, I’ll still be ok when I’m married, I’ll stop next time… Only a power that is greater than yourself can take away those plaguing thoughts. I find that I cannot obsess and pray at the same time so I open my mouth to G-d. Hashem is the source of all pleasure, good, love and warmth. He can give me what I’m looking for in masturbation. I have to let Him in. It works!
Hope this helps.
Good luck