Chronic pain and sleep disturbance are highly comorbid disorders, which leads to barriers to treatment and significant healthcare costs. Understanding the underlying genetic and neural mechanisms of the interplay between sleep disturbance and chronic pain is likely to lead to better treatment. In this study, we combined 1206 participants with phenotype data, resting-state functional magnetic resonance imaging (rfMRI) data and genotype data from the Human Connectome Project and two large sample size genome-wide association studies (GWASs) summary data from published studies to identify the genetic and neural bases for the association between pain and sleep disturbance. Pittsburgh sleep quality index (PSQI) score was used for sleep disturbance, pain intensity was measured by Pain Intensity Survey. The result showed chronic pain was significantly correlated with sleep disturbance (r = 0.171, p-value < 0.001). Their genetic correlation was rg = 0.598 using linkage disequilibrium (LD) score regression analysis. Polygenic score (PGS) association analysis showed PGS of chronic pain was significantly associated with sleep and vice versa. Nine shared functional connectivity (FCs) were identified involving prefrontal cortex, temporal cortex, precentral/postcentral cortex, anterior cingulate cortex, fusiform gyrus and hippocampus. All these FCs mediated the effect of sleep disturbance on pain and seven FCs mediated the effect of pain on sleep disturbance. The chronic pain PGS was positively associated with the FC between middle temporal gyrus and hippocampus, which further mediated the effect of chronic pain PGS on PSQI score. Mendelian randomization analysis implied a possible causal relationship from chronic pain to sleep disturbance was stronger than that of sleep disturbance to chronic pain. The results provided genetic and neural evidence for the association between pain and sleep disturbance, which may inform future treatment approaches for comorbid chronic pain states and sleep disturbance.