Erectile dysfunction and other forms of sexual dysfunction are highly prevalent among HIV+ men who have sex with men (MSM). Research has not previously identified the mechanisms by which depression may be associated with sexual dysfunction among HIV-positive and HIV-seronegative (HIV-negative) MSM. The present study examined the role of antidepressant use, stimulant use, and smoking as mediators of the relation between depression and sexual dysfunction among HIV-positive and HIV-negative MSM. Participants enrolled in the Multicenter AIDS Cohort Study, an ongoing prospective study of the natural and treated histories of HIV infection among MSM in the United States, completed a modified version of the International Index of Erectile Function for MSM. The study sample included 1,363 participants, with 619 HIV-positive men and 744 HIV-negative men. A structural equation model examined depression as a predictor of subsequent sexual dysfunction, mediated by antidepressant use, stimulant use, and smoking. Depression predicted subsequent sexual function among both HIV-negative and HIV-positive MSM. This effect appeared to be both a direct effect and an indirect effect via antidepressant use. Findings suggest that antidepressant medication use may partially explain sexual dysfunction among MSM.