Masturbation does not affect your brain. Some hormones (prolactin) that are secreted when you orgasm can make you depressed and feel guilty. Prolactin is one of the hormones that give woman postpartum depression. Oxytocin will make you feel good and sleepy. Orgasm will make you less jumpy and more relaxed.
Orgasm, or rather arousal and approach to orgasm, also promotes production of several neurotransmitters, most notably serotonin. Serotonin governs emotional stability and largely causes the serene post-coital experience.
Orgasm itself is essencially a dopamine burst. The chemical is channelled through the pituitary gland crushing the production of prolactin. If the brain is unable to produce dopamine receptors prolactin is produced in excess resulting in lethargy, feelings of depression or even pain. If excess dopamine receptors are produced Prolactin production grinds to a stop and the mind becomes disoriented and the metabolism slows causing sleep.