Don't try to give it up all at once, you'll fail - will power is finite for everyone. Instead, just try to scale it back. If you're masturbating 5 times a day at the moment, on Monday switch to 4 times a day, and two weeks later reduce it again to 3 times a day, and then to two times. After that you can decide whether you want to continue to reduce it to either a limit of once a day, once a week, or get rid of it altogether. Depending on how far you take it, you might want to extend the period of time for adaptation - e.g. spend 4 weeks instead of two weeks adjusting to only once a day.
Once you decide your goal, just cut it down gradually. If you try too much at once you will fail in your weaker moments, so just take it steady, reducing your limit every so often. All the best with it.