The drug , commonly known as Viagra, is a prescription treatment mainly used to treat difficulty achieving an erection in males . Developed initially for hypertension, its unexpected side effects relating to vasodilation led to its subsequent use as an effective solution for sexual dysfunction . It works by boosting the amount of blood to the penis