Both short sleep duration (SSD) and long sleep duration (LSD) are associated with an increased risk of morbidity and mortality. Here, we aimed to assess the prevalence of sleep duration disturbances among adults in association with demographic, medication use, personal habits, and chronic diseases, while also considering the impact of hypnotic drug use. We performed a cross-sectional study of 9991 adult participants of the Rafsanjan Cohort Study (RCS), as part of the Prospective epidemiological research studies in Iran (PERSIAN). Multivariate logistic regression analyses were conducted to assess the association between short (< 6 h) and long (> 9 h) sleep duration with demographic and lifestyle parameters and common non-communicable diseases. Additionally, we performed stratified analysis to investigate the association of sleep duration with the abovementioned factors and diseases, in groups with and without hypnotic drug use. We found higher odds of SSD significantly associated with age (P < 0.001), BMI (P < 0.001), physical activity (P < 0.001), and depression (P = 0.023). LSD displayed a positive association with the female sex (P < 0.001), opium consumption (P < 0.001), and history of MI (P = 0.045), and a reverse connection with education (P = 0.007), physical activity (P < 0.001) and alcohol consumption (P = 0.027). Stratifying for the hypnotic drug use, our sensitivity analyses indicated that in hypnotic drug users, education (P = 0.034) and physical activity (P < 0.001) were associated with LSD, in this group, significantly increased odds ratio of LSD were associated with opium consumption (P = 0.046) and thyroid dysfunction (P = 0.037). Our findings demonstrated the demographic and lifestyle factors and diseases associated with long and short sleep duration in the population of the RCS. Additionally, after stratifying for hypnotic drug use, our results indicated that some diseases are only associated with abnormal sleep duration upon using hypnotic drugs.