You can work on this through mindfulness, yoga, or stretching, or before hand doing a hard workout
. Pay attention to what your body
does during masturbation and orgasm. Try to fight it.
Try the start stop method, which is said to work. Masturbate until you feel it coming on, and then stop. It can feel like torture, but it gains you more control.
Mostly, doing it more, usually ups your endurance.
I am sure there are more tips i havent mentioned...