Viagra is used to treat erectile dysfunction (impotence) in men. The anti-impotence drug works by relaxing the smooth muscles in the blood vessels around the penis, which increases blood flow to the penis facilitating an erection.