A reason causing erection in sleep is the bladder being full that stimulates nerves in a region similar to nerves responsible for erections.
Healthy erections are part of a healthy sex life for a man and getting erections frequently may be considered a good sign. But sometimes randomly getting erections without any stimulation may point in the direction of something much more serious.
While an erection happening out of the blue can be embarrassing, it can also be a sign of erectile dysfunction. An erection usually occurs when brain sends signals to arteries in the penis which dilate and allow it to be filled with blood.
One reason causing erection in sleep is the bladder being full which stimulates nerves in a region similar to nerves responsible for erections. Fluctuation in hormone levels causing a spike in testosterone may also be responsible for men experiencing random erections any time during the day.
When a man experiences random erections while sleeping or in any other situation but struggles to perform in bed, it might be a case of psychological erectile dysfunction.