This study investigated the correlation between irritable bowel syndrome (IBS) and organic erectile dysfunction (OED) and psychogenic erectile dysfunction (PED), and analyzed the influence of various comorbidities. Data were obtained from reimbursement claims of the National Health Insurance Program in Taiwan. We selected male patients aged >20 years, who were diagnosed with IBS during the 2000-2011 period as the IBS cohort. The index date for patients with IBS was the date of their first medical visit. We excluded patients with a diagnosis of OED and PED at baseline and those without information on age and sex. The IBS to non-IBS cohorts were estimated using univariable and multivariable Cox proportional hazards regression model. Adjusted hazard ratios were determined after adjusting for age and comorbidities. The Kaplan-Meier method was used to plot the cumulative incidence of OED and PED, and a log-rank test was used to compare the cohorts. A total of 15,533 IBS patients and 62,124 controls without IBS were enrolled in our study. Among the study participants, 48.2% were 49 years of age or younger. Patients with IBS were more likely to develop erectile dysfunction (ED) than those without IBS. Patients with IBS were 2.12 times more likely to develop OED and 2.38 times more likely to develop PED than the controls. There is an increased risk of both PED and OED in patients with IBS. Not only with organic but also PED should be considered when patients with IBS complain of ED.