Sleep duration is a novel and potentially modifiable risk factor for cancer. We evaluated the association of self-reported sleep duration and daytime napping with odds of colorectal and gastric cancer. We included 2008 incident colorectal cancer cases, 542 gastric cancer cases and 3622 frequency-matched population controls, recruited in the MCC-Spain case–control study (2008–2013). Sleep information, socio-demographic and lifestyle characteristics were obtained through personal interviews. Multivariable adjusted logistic regression models were used to estimate odds ratios (OR) with 95% confidence intervals (CI) for cancer, across categories of sleep duration (≤ 5, 6, 7, 8, ≥ 9 hours/day), daytime napping frequency (naps/week) and duration (minutes/nap). Compared to 7 hours of sleep, long sleep was associated with increased odds of colorectal (OR≥9 hours: 1.59; 95%CI 1.30–1.94) and gastric cancer (OR≥9 hours: 1.95; 1.37–2.76); short sleep was associated with increased odds of gastric cancer (OR≤5 hours: 1.32; 0.93–1.88). Frequent and long daytime naps increased the odds of colorectal (OR6–7 naps/week, ≥30 min: 1.32; 1.14–1.54) and gastric cancer (OR6–7 naps/week, ≥30 min: 1.56; 1.21–2.02). Effects of short sleep and frequent long naps were stronger among participants with night shift-work history. Sleep and circadian disruption may jointly play a role in the etiology of colorectal and gastric cancer.