Erections can happen more often during puberty. This is when blood flows into the spongy tissue of the penis and it becomes thicker, longer and stiffer. When this blood flow stops the erection goes away.
Sometimes erections can happen when a boy is asleep and he may ejaculate (release semen). This is called a ‘wet dream’ and is a boy’s body getting used to its new sperm production. Wet dreams usually happen less often as boys get older.