Why do I wake up with an erection?

I am aged 19. Whenever I wake up in the morning, my penis is erect. What causes this and how should I prevent it?

Dear Doctor,
I am aged 19. Whenever I wake up in the morning, my penis is erect. What causes this and how should I prevent it? 
Samuel 
 
Dear Samuel,
In medical jargon, morning erections are called nocturnal penile tumescence. This is a healthy and normal physiological response that most men experience. 
 
Morning erections would be better described as the tail-end of a series of nighttime erections — they are just the last of a series of erections that occur three to five times at night. The common belief that morning erections are caused by a full bladder are just a myth. 
 
Other people attribute them to a complex chemical and hormonal process that happens when men are deep asleep. However, this is a condition that doctors continue to theorise and form opinions about, as it is not yet fully understood.