Sounds like an infection, likely originating in your prostate. You need to release your semen 1-2x a week to clean out your prostate. If you are not ejaculating at night, you need to masturbate.
Are you sure it's sperm, or just cloudy urine? Sperm is not usually present in urine and vice versa. If it's cloudy, I would see a doctor. I don't think it has anything to do with the masturbating either. Good luck to you.