This study investigated the association between sleep duration, depression, and breast cancer using data from the National Health and Nutrition Examination Survey (NHANES) 2009-2018. Logistic regression analysis revealed a significant association between depression and breast cancer (OR = 1.99, 95% CI: 1.55–3.51), but no significant association was found between sleep duration and breast cancer. Six machine learning algorithms were used to predict breast cancer, with AdaBoost showing the best performance (AUC = 0.84).