IntroductionDepression and chronic pain are significant contributors to the global burden of disease. Previous research has revealed complex relationships between these two conditions, which may be influenced by sleep quality. However, observational studies have limitations, including confounding factors and reverse causation. This study aims to explore the mediating effects of sleep on the relationship between depression and chronic pain using Mendelian randomization (MR).MethodsWe conducted a two‐step, two‐sample MR study using mediation analysis. We obtained major depressive disorder (MDD) Genome‐Wide Association Studdies (GWAS) data from Wray et al.’s GWAS meta‐analysis. Phenotypic data related to sleep were collected from the UK Biobank. Chronic pain data were obtained from the Finnish database.ResultsMR analysis revealed significant genetic associations between MDD and chronic localized pain [IVW: odds ratio (OR) = 1.26, 95% confidence interval (CI) = 1.16–1.38, p = 2.52 × 10–7] as well as fibromyalgia (IVW: OR = 2.17, 95% CI = 1.34–3.52, p = .002). Genetic susceptibility for MDD was also associated with insomnia (IVW: OR = 1.10, 95% CI = 1.06–1.13, p = 3.57 × 10–8) and self‐reported short sleep duration (IVW: OR = 1.03, 95% CI = 1.00–1.06, p = .047). The mediating effects of insomnia and fibromyalgia on the pathway from depression to chronic regional pain were 1.04 and 1.03, respectively, with mediation proportions of 12.8% and 15.2%. Insomnia mediated the pathway between depression and fibromyalgia with an effect of 1.12, accounting for 15.2% of the total effect.ConclusionThis two‐step MR analysis strengthens the evidence of genetic predictive associations between depression and chronic pain, highlighting the mediating roles of insomnia and short sleep duration. It further elucidates the specific roles of distinct sleep disorders, differentiating insomnia and short sleep duration from other sleep‐related phenotypes.