Erectile dysfunction (ED) is a prevalent complication associated with diabetes mellitus (DM), yet pharmacological treatments for diabetes-related erectile dysfunction (DMED) continue to be inadequate in clinical settings. Our previous studies have indicated that there is a close correlation between ED and pyroptosis, but the specific mechanism remains unclear. In this study, we sought to explore the therapeutic effects of DMED through the modulation of NLRP3, aiming to elucidate its potential molecular mechanisms. The DMED rat model was established via intraperitoneal injection of streptozotocin. The rats were randomly assigned to the control group, the DMED group, the Yimusake group, the MCC950 (NLRP3 inhibitor) group, and the MCC950+Yimusake group. Erectile function of rats was observed by measuring intracavernosal pressure (ICP) and mean arterial pressure (MAP). HE staining was performed to observe the histopathological changes in penile; immunofluorescence was performed to measure the level of CD31 (Platelet endothelial cell adhesion molecule-1) in penile. Besides, immunohistochemistry, RT-qPCR and Western blot were performed to demonstrate the expression of NLRP3, caspase-1, IL-1β and eNOS. After treatment with the MCC950 and Yimusake, the number of blood sinusoids and small vessels significantly reduced in penile tissue; NLRP3, caspase-1, IL-1β proteins and mRNA expression decreased, eNOS protein and mRNA expression increased. Compare with the Y group and the MCC950 group, MCC950+Yimusake group had a more significant effect. MCC950 and Yimusake might potentially suppress pyroptosis in the penile tissue of DMED rats by modulating the NLRP3/caspase-1 pathway, thus enhancing erectile function. This discovery could offer a promising therapeutic approach for individuals with DMED.