this happens to me from time to time. its friction burns. ie not using any or enough lube when masturbating. it can also happen if i have masturbated several times in the same day. you need to stop playing with yourself and perhaps apply some moisturiser which does not have any perfume in it as this could course further irritations.
hope this helps.