Deal with tough times
Often, the need to seek self-pleasure comes from a mild-depression. Almost 50% of humans have a tendency to some form of depression, even if they don't know or admit it, and it is often this feeling of "void" or "emptiness" that can bring one to seek ways to sooth themselves and make themselves feel better. There are a number of good ways to deal with a mild-depression.
1) The best way is exercise. There is no better drug for the mind than getting the heart pumping and the blood flowing to the brain. In just 15 minutes of a good work-out, the empty feelings will have disappeared! This is a little know, but amazing technique which has saved so many people. I personally know of three people who were going through hard times and feeling down and depressed, who say that their lives have literally been saved by this technique. They would take a good, 20 minute walk, once a day, and felt happy and invigorated for the whole day afterwards.
2) The second way is to always keep busy. Torah, work, family and good deeds, there's so much to do if you want to stay active!
3) The third way, is to tell yourself that although you may feel down, giving into self-pleasure is a total cop-out which only helps for the few minutes that you lose yourself in the oblivion. Ultimately however, it only makes the symptoms worse with every time one indulges in such behavior.
4) The fourth way to deal with a mild-depression is through SSRI medication. SSRI medications are taken by millions of people world wide, and today there are types that have virtually no side effects.