The saints have pretty much unanimous advice - run away from the occasion of the sin.
Mortifying your body in other ways also helps to train it and to distract it.
Cold showers. Fasting. Less sleep. The body seeks to avoid pain more than it seeks to obtain pleasure.
Prayer and the sacraments are also vital. You also might try some extended prayer whenever you can’t otherwise remove yourself from an occasion of sin - such as praying the rosary… It will repel you from the thought of self-abuse, as you will be disgusted by the idea. Keeping devotionals in places you normally face temptation might also help (like a crucifix by your bed).
Also, put the computer in an open room and leave it there. Consider a program like Covenant Eyes and getting someone to be your accountability partner.
NEVER go looking for programs or pictures that are sexual in nature or contain anything that could be easily sexualized by yourself. (For example, if you watch HBO, maybe it’s time to stop.) If you come across one, move along quickly and refocus your attention.
When you feel your sensuality begin to rise, physically get up and move around. Go for a walk, maybe a run.
Avoid alcohol, especially around the opposite sex.
You have to put distance between yourself and the occasion of this sin, or you will not last long. This is the reality.