When I was younger I almost always had an erection when I woke up, as well as several times during the night. The nocturnal erections all but disappeared 15 years ago, and soon after I had my first coronary stent placement.
As of now, the only time I can count on a nocturnal erections is when I have taken an ED pill that evening. Oh to be young again!
They've definitely gotten less frequent as I've gotten older. Oddly, many of the occurrences now seem to correlate to a build-up of gas in the rectum. I'm used to a full bladder causing them, but the gas thing is pretty new.