Sildenafil works by inhibiting the action of PDE5, an enzyme that regulates blood flow in the penis. By blocking PDE5, sildenafil helps relax the smooth muscles in the penile blood vessels, leading to increased blood flow and improved erectile function.