Thanks for writing in.
What you are currently experiencing is a normal phenomenon. Nocturnal penile tumescence(the penis becoming erect in late night and early morning) is a normal phenomenon and is seen in all men post puberty
. It is specifically seen in a phase of sleep called REM
sleep or rapid eye movement
I would like to reassure you that nothing is wrong.
Hope this helps