Erection depends largely on the release of nitric oxide (NO) by vascular endothelial cells. Insulin resistance (IR) is a metabolic abnormality that produces endothelial dysfunction characterized by decreased synthesis and release of NO. The aim of this paper is to evaluate the effect of treatment with metformin on the response to sildenafil in patients with erectile dysfunction (ED) and IR enrolled in a prospective, randomized, controlled, double-blind placebo study. We included 30 male patients with ED, IR, and poor response to sildenafil. Exclusion criteria included pharmacologic, anatomic, or endocrine ED; diabetes; prostatic surgery; or chronic illnesses. Erectile function was rated according to the International Index of Erectile Function 5 (IIEF-5); IR was measured by homeostasis model assessment (HOMA; IR = HOMA ≥ 3). Patients were randomized to receive metformin (n = 17) or placebo (n = 13). After treatment with metformin, patients with ED showed a significant increase in IIEF-5 score and a significant decrease in HOMA, both occurring at month 2 (IIEF-5: 17.0 ± 6.0 vs 14.3 ± 3.9, P = .01; HOMA: 3.9 ± 1.6 vs 5.5 ± 2.4, P = .01) to 4 of treatment (IIEF-5: 19.8 ± 3.8 vs 14.3 ± 3.9, P = .005; HOMA: 4.5 ± 1.9 vs 5.5 ± 2.4, P = .04), with no changes in these parameters in patients with ED receiving placebo. Patients treated with metformin had more adverse events than those who received placebo: 61.5% compared with 7.7%, P = .03, respectively. Adverse events were mild, mainly gastrointestinal, and did not cause discontinuation of treatment. Treatment with metformin in patients with ED and poor response to sildenafil reduced the IR and improved erectile function.