SRPEs seem to occur during REM sleep, just like non-painful sleeping erections. However the pain itself might be the result of either spasms or ischemia. Oral baclofen currently appears to be the experimental treatment of choice, but that may change when more is learned about SRPEs.
If you are experiencing sleep-related painful erections, a consultation with a urologist is in order.
As for regular non-painful sleep erections, the idea that they are the same as daytime erections that just happen while you are sleeping is being questioned by researchers. It's possible that different neurological pathways are involved. One shouldn't assume a man who wakes with an erection is necessarily horny.
















