How does increased blood flow make the penis erect

Prior to arousal, when the penis is totally flaccid and its arteries and sinuses are contracted, penile blood flow is low, amounting to about 1 - 2 milliliters per minute, but when sexual stimulation and excitement produce penile vasodilation, penile blood flow increases to about 90 milliliters per minute. This increased inflow to the corpora swells the penis, which becomes tumescent: longer and thicker but not yet hard. Then, as more blood flows into the penis and the corpora (mainly, the cavernosa) become engorged, the dilated penile sinuses crowd and compress the veins of the penis against the tunica albuginea. This compression dramatically reduces the penile venous outflow, trapping blood within the penis.

With more blood coming in than going out, pressure in the penis builds, pushing in all directions - much like an inflating balloon - and as a result of this pressure the congested penis straightens, elongates, expands, and becomes firmly erect. Once the penis is full to capacity, blood flow both in and out of the corpora decreases to a minimum and then stops completely after the ischiocavernous muscles contract, maintaining a rigid erection.