IntroductionSleep disorders represent a significant health concern among individuals diagnosed with type 2 diabetes. Identifying the prevalence and underlying factors contributing to these disorders is crucial for devising effective interventions to mitigate or resolve this issue. MethodsThis cross-sectional study was undertaken, involving 320 patients diagnosed with type 2 diabetes, who were attendees of the Hamadan Diabetes Clinic in 2023. Data collection was done using the demographic information checklist and the Pittsburgh Sleep Quality Index. Furthermore, the study examined the associations between sleep quality and demographic parameters, hemoglobin A1C levels, body mass index, and duration of diabetes by the t-test, chi-square test and logistic regression analysis. Poor sleep quality was defined as a sleep quality score exceeding 5. Results70.3 % of participants exhibited poor sleep quality. Female gender, hemoglobin A1c levels exceeding 7.5 %, a body mass index exceeding 30 kg/m2, and advancing age were associated with an increased likelihood of poor sleep quality. Higher levels of education were correlated with a decreased likelihood of poor sleep quality (P < 0.001). Female patients had significantly higher body mass index (P = 0.003), higher hemoglobin A1c (P = 0.006) and lower education (P = 0.001). ConclusionThe results of this study underscore the significance of enhancing sleep quality among individuals diagnosed with type 2 diabetes. Accordingly, healthcare providers are recommended to prioritize interventions targeting factors influencing sleep quality and imparting blood sugar management education. Addressing these factors comprehensively can manage diabetes-related complications, resolve sleep disorders, and facilitate the adoption of healthy lifestyle behaviors among patients.