Introduction

Sleep problems (SPs) represent a significant global health challenge, impacting individuals across diverse national and cultural backgrounds1,2. Research consistently demonstrates that both short and long sleep durations are associated with various health outcomes, including increased risks of mortality, cardiovascular diseases, and mental health disorders3. The National Sleep Foundation provides age-based sleep duration guidelines, which are widely applied in sleep research to classify adequate and inadequate sleep4. A 2019 nationwide cross-sectional online survey in China revealed that the crude incidence rate of self-reported SPs among Chinese residents was 19.16%, with the age-adjusted rate slightly higher at 21.25% 5. This estimate shows that such SPs may affect approximately 300 million participants in China. SPs are associated with many health issues, including cardiometabolic, neurological, psychiatric, and psychological disorders, and they compromise the immune system and increase the risk of traffic and occupational accidents2. Furthermore, obstructive sleep apnea syndrome, along with hypertension, obesity, diabetes, and hyperlipidemia, significantly contributes to the top ten risk factors for early mortality and disability-adjusted life years6.

Chronic pain, a prevalent and incapacitating condition, is identified as a major contributor to disability globally and significantly adds to the global disease burden, affecting approximately one-third to one-half of the worldwide population7,8. The onset and chronicity of pain are shaped by a dynamic, multidimensional interaction between psychological, sociocultural, and biological determinants, wherein these factors mutually affect each other9. Additionally, genetic predispositions play a role in chronic pain10. Estimates suggest that the heritability of susceptibility to chronic pain ranges between 25% and 50% 11. Recent studies have unveiled the most extensive multi-ancestry, single-sample Genome-Wide Association study on pain intensity, uncovering 126 independent risk loci via cross-ancestry analysis12.

There is a bidirectional relationship between SPs and chronic pain: SPs can lead to the onset of chronic pain, and sleep deprivation can intensify and prolong chronic pain8,13,14. Depression serves as a frequent mediator in the connection between SPs, pain, and overall health outcomes15. Furthermore, chronic disorders are linked with SPs, pain, and symptoms of depression16. Social engagement can both directly and indirectly influence the bidirectional interaction between SPs and pain via its effects on depressive symptoms15.

The Coronavirus Disease 2019 (COVID-19) pandemic has drastically affected various global sectors, including the economy, societal structures, and healthcare systems, leading to increased health challenges and a higher prevalence of COVID-19-related conditions such as sudden sensorineural hearing loss17,18. The psychological impact of the pandemic has been widely studied, revealing significant increases in anxiety, depression, and SPs across various populations19. Research spanning 13 countries with 19,267 adults and a meta-analysis of 66 studies including 221,970 participants have highlighted a surge in sleep and mental health issues, with reported increases in depression, anxiety, distress, and insomnia20,21. Despite these findings, studies exploring the bidirectional relationship between sleep duration and pain, as well as the mediating effects of depression and other factors, remain limited during the pandemic.

Addressing these research gaps, this study delves into the mutual influence of sleep duration and pain during the COVID-19 pandemic and evaluates depression, chronic diseases (CDs), and personal activity during COVID-19 as mediating influences within the China Health and Retirement Longitudinal Study (CHARLS) cohort. Unraveling these dynamics is pivotal for managing CDs amid pandemic conditions, focusing on enhancing the well-being of participants facing these challenges.

Methods

Participants

This study’s participants were drawn from the CHARLS database. CHARLS, a nationally representative longitudinal survey, targets Chinese individuals aged 45 and above, along with their spouses. It examines community residents’ social, economic, and health aspects22. The study employs a multistage stratified probability sampling method to ensure the sample is representative of the Chinese population aged 45 and older. The sampling process began with selecting county-level units using a probability-proportional-to-size method, then randomly selecting villages and urban communities. Households were then randomly selected from these communities. The 2011 CHARLS survey included 17,708 participants from 10,257 households in 450 villages and communities across 28 provinces of China22,23. The sample size in this study was determined using available data from the 2020 wave of CHARLS, which included participants who completed the sleep and pain-related questions. This sample size enables robust statistical analysis of the associations between sleep, pain, and depression.

Study design

This study employed an observational cross-sectional design, suitable for exploring associations and mediation effects between variables in large population-based datasets. This design was chosen for its ability to capture relationships between sleep duration, pain, and mediating factors such as depression and CDs simultaneously. Although cross-sectional designs cannot establish causality, they identify significant associations and can inform future longitudinal studies. Given the exploratory nature of this research and the availability of data from the CHARLS cohort, this design facilitated a robust analysis of the interaction between sleep and pain during the COVID-19 pandemic.

Ethics approval

The study was granted by the Biomedical Ethics Committee of Peking University, Beijing, China (reference number: IRB00001052–11015). All participants or their legal representatives gave written informed consent for involvement in both the baseline and follow-up surveys. Data analysis was performed anonymously, ensuring the nondisclosure of participants’ personal identity information. All methods adhered to relevant guidelines and regulations, including the Declaration of Helsinki and the ethical standards set forth by the aforementioned ethics committee.

Sleep duration

Sleep duration was evaluated based on self-reported nocturnal sleep, a widely used measure in sleep research24,25. Sleep duration was determined from self-reported data collected through the question, “In the past month, on average, how many hours per night did you sleep?” Self-reported sleep duration has shown a moderate correlation with objective measures like actigraphy and reliably reflects typical sleep patterns in large epidemiological studies26. Based on the National Sleep Foundation’s recommendations, participants were categorized into four groups: those sleeping 7 to 8 h were given a score of 0, representing optimal sleep duration; scores of 1 and 2 were assigned to those reporting slightly shorter or longer sleep durations (6 to 7, 8 to 9 h and 5 to 6, 9 to 10 h, respectively); and a score of 3 was assigned to extreme deviations from the recommended sleep duration (less than 5 or more than 10 h)4,15.

Pain

The study investigated the distribution of pain across anatomical locations. Participants who did not report any pain were assigned a score of zero. Participants reporting pain were asked to indicate the affected areas on a validated anatomical chart listing body parts such as the head, shoulders, and arms27. Each reported area of pain received one point, resulting in a total pain score ranging from zero to 16, representing the extent of pain across different body regions. However, this method did not assess the frequency or severity of pain. These assessment methods comply with the guidelines for population-based pain research, thereby supporting the validity and reliability of the study28.

Depression

The 10-item Center for Epidemiologic Studies Depression Scale (CES-D-10) was used to evaluate depressive symptoms, covering a range of emotional states and physical symptoms experienced in the previous week. The items on the CES-D-10 are scored on a scale from 0 to 3, yielding total scores ranging from 0 to 30, where higher scores indicate more severe depressive symptoms. Research shows that the CES-D-10 is reliable and valid, with Cronbach’s alpha ranging from 0.78 to 0.79 in elderly Chinese populations29. It has been validated for use in elderly Chinese populations and is widely recognized for its psychometric properties, making it appropriate for assessing mental health in this study29.

Chronic diseases

The CHARLS questionnaire asked participants, ‘Has a physician ever informed you that you have a specific disease?’ This questionnaire included a list of fifteen common CDs. Based on their responses, participants were categorized into two groups: those diagnosed with a chronic disease (‘Yes’) and those without such a diagnosis (‘No’).

Personal activity score during COVID-19

In response to the COVID-19 pandemic, CHARLS introduced a section on COVID-19, its first inclusion in the survey. Comprising 16 questions, this section explores a broad spectrum of changes in participants’ daily lives because of the pandemic. These include changes in outing frequency, duration of outdoor activities, exercise intensity, and social interaction patterns, such as visiting friends, playing games such as mahjong, chess, or cards, and square dancing. It also examines variations in communication methods, including phone calls, text messaging, and online interactions, as well as changes in emotional states and lifestyle habits, including feelings of fear, nervousness, anxiety, and changes in smoking and drinking habits, sleep schedules, and dietary intake. One sleep-related question was omitted, and the remaining 15 were quantitatively evaluated. Thirteen questions ranged from ‘significant increase’ to ‘significant decrease,’ with scores from 5 to 1 indicating the degree of change. The other two questions addressed emotional aspects such as fear and nervousness, offering choices from ‘little or none’ to ‘most of the time’, with scores from 4 to 1. This scoring system, ranging from 8 to 73 and termed the personal activity score during COVID-19 (PAS-COVID-19), facilitates a quantitative assessment of the pandemic’s impact on participants’ lifestyles.

Other covariates

The analysis included demographic covariates, such as age, gender, and afternoon napping habits. Information on afternoon napping was collected by asking, ‘In the past month, how many minutes do you typically spend napping in the afternoon?’ Participants were classified based on their napping status into ‘Yes’ for nappers and ‘No’ for non-nappers25.

Statistical analyzes

Statistical analyzes were conducted with R software (version 4.3.3). Frequencies (n) and percentages (%) were used to represent categorical variables, while the normality of continuous variables was assessed using histograms and Q-Q plots. Means and standard deviations (SD) describe the central tendency and variability of variables adhering to a normal distribution. In contrast, variables not following a normal distribution were characterized by medians and interquartile ranges (IQR), offering a more precise depiction of their central tendency and spread. Spearman rank correlation was used to evaluate the strength and direction of the association between sleep duration and pain prevalence, since this non-parametric test is appropriate for ordinal or non-normally distributed data. The Mann-Whitney U test was applied to compare sleep duration between groups (with and without pain), because this test is robust to deviations from normality. A p-value of less than 0.05 was considered statistically significant.

Mediation analysis was conducted using the ‘mediation’ package with bootstrap resampling of 1000 replications. Bootstrapping with 1000 resamples was used to estimate confidence interval (CI) and effect sizes, ensuring a more precise evaluation of the indirect effects. A 95% CIs and a significance level of p < 0.05 were used for all statistical tests.

Results

Characteristics of participants

The 2020 CHARLS included 19,395 participants. Initially, 3,230 participants were removed because they lacked CES-D-10 data, reducing the number to 16,165. Subsequently, 186 more participants were removed because of incomplete data on sleep duration (120 participants) and afternoon napping (66 participants), yielding a final cohort of 15,979. Figure 1 offers a comprehensive overview selection process.

Fig. 1
figure 1

Figure shows the participant screening flowchart.

The average age of participants in this study was 60.45 years (SD = 9.28). The gender distribution was balanced, with 7,664 males (47.96%) and 8,315 females (52.04%). Regarding CDs, 5,846 participants (36.59%) reported having a chronic disease, compared to 10,133 (63.41%) who did not. A significant number, 10,259 (64.20%), took part in afternoon napping, in contrast to 5,720 (35.80%) who did not. The median sleep duration was 6.00 h (IQR: 5.00–7.00; range: 0–15 h), with a median sleep duration score of 1.00 (IQR: 0.00–2.00; range: 0–3). Among participants, 9,261 (57.96%) reported experiencing pain, while 6,718 (42.04%) did not. The median pain score was 1.0 (IQR: 0.0–4.0; range: 0–16), and the median CES-D-10 score for depression was 9.0 (IQR: 6.0–13.0; range: 0–30). The median score for PAS-COVID-19 was 28.00 (IQR: 24.00–32.00; range: 8–59), reflecting variability in participant engagement. The characteristics of participants are detailed in Table 1.

Table 1 Patient demographics and baseline characteristics.

Impact of sleep on pain

Prevalence and classification of sleep duration among participants

Sleep duration was evaluated based on participants’ self-reported hours of sleep. Of the total, 5,225 participants (32.70%) reported a sleep duration of 7 to 8 h per night, which was scored as 0 to indicate optimal sleep duration. In contrast, 10,754 participants (67.30%) reported shorter or longer sleep durations: 4,645 participants (43.19%) reported sleeping 6 to 7 or 8 to 9 h (score = 1), 3,199 participants (29.75%) slept 5 to 6 or 9 to 10 h (score = 2), and 2,910 participants (27.06%) slept less than 5 or more than 10 h (score = 3), reflecting deviations from the recommended sleep duration.

Correlation between pain frequency and sleep duration scores

The study assessed the correlation between pain frequency and sleep duration across four categories of sleep duration scores. Among participants with optimal sleep duration (score = 0), 2,659 (50.89%) reported no pain, while 2,566 (49.11%) experienced pain. In those with a sleep duration score of 1, 2,597 (55.91%) reported pain, compared to 2,048 (44.09%) who did not. For participants with a score of 2, 1,980 (61.89%) experienced pain, while 1,219 (38.11%) did not. The strongest trend was observed in participants with the most extreme sleep durations (score = 3), where 2,118 (72.78%) reported pain, compared to 792 (27.22%) who did not. Statistical analysis confirmed a significant association between deviations in sleep duration and pain frequency (p < 0.001), as shown in Fig. 2.

Fig. 2
figure 2

Figure shows the correlation between the sleep duration scores and pain frequency.

Mediation analysis of sleep duration scores, depression, and CDs on pain scores

A parallel multiple mediation analysis model was conducted to evaluate the effect of sleep duration scores on pain scores, with CES-D-10 scores, CDs, and PAS-COVID-19 acting as mediators. Sleep duration scores had a direct effect size of 0.389 on pain scores. Depression symptoms, as measured by the CES-D-10, had an indirect effect size of 0.165 (SE = 0.009, Z = 18.628, p < 0.001), suggesting that depression symptoms are significant mediators of the relationship between sleep duration scores and pain scores. Chronic disease also had a mediation effect, with an indirect effect size of 0.021 (SE = 0.006, Z = 3.758, p < 0.001). In contrast, PAS-COVID-19 had no significant mediation effect, with an indirect effect size of 0.001 (SE = 0.001, Z = 1.308, p = 0.191). The analysis adjusted for age, gender, and afternoon napping to minimize potential confounding variables, as shown in Table 2; Fig. 3. These findings reveal the complex interplay between sleep duration scores, depression, and CDs in shaping pain, emphasizing the necessity to incorporate these factors into pain management strategies.

Table 2 Mediation analysis for the associations between the Sleep Duration scores and Pain score.
Fig. 3
figure 3

Figure shows the mediation analysis model of the effect of sleep disorders on pain. Note: PAS-COVID-19: Personal activity score during COVID-19.

Effects of pain on sleep

Distribution characteristics of pain locations

Analysis indicated that the waist was the most frequently reported pain ___location, noted by 5,304 participants (57.27%), followed by the knees and legs, which were reported by 4,094 (44.21%) and 3,655 (39.47%) participants, respectively. Given their high prevalence, these findings highlight the need for targeted interventions addressing pain in these specific areas.

Correlation between frequency of pain at different body sites and sleep duration scores

The study examined the correlation between the frequency of pain at different body sites and sleep duration deviations (scored from 0 to 3). As illustrated in Fig. 4, pain in the waist, knees, and legs showed a significant correlation with shorter sleep duration. Waist pain was specifically associated with sleep duration deviations at scores of 1 and 3, indicating a high pain prevalence among participants with moderate and extreme deviations. Among participants with both moderate and extreme deviations, there was a high prevalence of pain. The strongest correlation was observed with head pain, with a correlation coefficient of approximately 0.156 (p < 0.001), particularly at extreme sleep duration (score of 3). Comparable correlations were found for waist, leg, and knee pain, with coefficients of approximately 0.145, 0.143, and 0.143, respectively (p < 0.001), indicating a significant link between pain in these locations and sleep duration deviations.

Fig. 4
figure 4

Figure 4 shows the correlation between the frequency of pain in different body parts and the sleep duration scores.

Influence of pain on sleep duration

The unstratified analysis demonstrated that participants with pain reported significantly shorter sleep duration compared to those without pain (p < 0.001, W = 37,453,101) (Fig. 5A). When stratified by gender, the analysis revealed a similar trend: both males and females with pain experienced shorter sleep duration (p < 0.001). However, males exhibited greater variability in sleep duration compared to females (p < 0.001, W = 8,454,692 for males; W = 9,454,363 for females) (Fig. 5B). These findings indicate a strong association between pain and shorter sleep duration across all participants, highlighting the impact of pain on sleep quality.

Fig. 5
figure 5

Figure illustrates the effect of pain on sleep duration. (A) Significantly shorter sleep durations in participants with pain compared to those without pain (p < 0.001). (B) Shorter sleep durations in both males and females with pain, with males exhibiting greater variability (p < 0.001).

Discussion

This study provides insights into the interactions between sleep duration, pain, depression, CDs, and personal behaviors during the COVID-19 pandemic. Many participants displayed varying levels of reduced sleep duration, which correlated strongly with the presence of reported pain. Our analysis identified a clear association between pain and shorter sleep duration, with participants reporting pain experiencing shorter sleep than those without pain (p < 0.001, W = 37,453,101). This association remained consistent when stratified by gender, although males reporting pain exhibited greater variability in sleep duration (p < 0.001, W = 8,454,692 for males; W = 9,454,363 for females). These results indicate that pain affects sleep duration, emphasizing the need for targeted interventions addressing both sleep and pain, particularly in males, who may experience greater variability in sleep patterns associated with pain.

Depression and CDs act as key mediators in the relationship between sleep duration and pain. Our mediation analysis identified depressive symptoms (CES-D-10 scores) and CDs as significant mediators in this relationship, although personal activity levels during the pandemic showed no significant mediation effect. These results highlight the intricate relationship between sleep duration and pain, further complicated by depressive symptoms and CDs, emphasizing the necessity for comprehensive approaches in pain management strategies.

Sleep duration deviations are often associated with chronic pain, a complex relationship that warrants further investigation30,31. A meta-analysis of chronic pain sufferers found a high prevalence of sleep disturbances32. Similarly, Miettinen et al. reported that 43.4% of tertiary pain care patients experienced sleep disturbances, emphasizing their common occurrence30. A survey of 18,980 participants across five European countries showed that 40.2% of those with SDs also suffered from chronic pain, confirming a solid correlation33. This study found that 62.26% of participants with deviations from optimal sleep duration reported pain. This rate is higher than reported in some previous studies. The higher pain incidence may be due to the older demographic of this study, indicating that sleep interventions for older adults could help alleviate chronic pain.

Although substantial evidence supports the association between sleep and pain, the biological mechanisms remain unclear31,32,34. Neurochemical pathways, such as the opioid and monoaminergic systems, orexinergic neurons, and the hypothalamus-pituitary-adrenal axis, may regulate sleep and pain14. Additionally, genetic factors may contribute, as twin studies have demonstrated genetic overlaps between SPs and chronic pain35,36,37. A recent study expands on these findings using genotype data, resting-state functional MRI, and phenotypic data from the Human Connectome Project, identifying key genetic correlations and shared neural pathways mediating their complex relationship35. Further research is needed to elucidate these mechanisms.

Mediation analysis, a fundamental statistical approach, investigates the effect of an independent variable on a dependent variable via a mediator, which is crucial for understanding the mechanisms underlying relationships across various research fields38. Recently, this analysis has been used to investigate the complex relationship between SDs and pain15,30,39. The mediators connecting SDs and pain include affect/mood, depression and/or anxiety, attention to pain, feelings of helplessness about pain, stress, fatigue, and physical activity39. Depression, in particular, has received considerable attention as a critical mediator15,30. A study comparing pain patients with SDs showed that 31.6% exhibited symptoms of depression, a significant increase compared to the 5% among those without such conditions. This difference underscores the importance of addressing sleep issues to ease depressive symptoms30. A recent investigation using the CHARLS cohort found that depressive symptoms serve as a mediator between earlier SDs and subsequent pain, quantitatively confirming this relationship with an effect size of 21.98% (β = 0.020; SE = 0.004; P < 0.001)15. Our research found that CES-D-10 scores, indicative of depression, act as an important mediator between sleep duration scores and pain, consistent with existing studies.

CDs are closely linked with sleep duration, as poor sleep can exacerbate chronic conditions and vice versa40. Our results support the need for integrated interventions that address both sleep and chronic disease management, particularly among older adults, who are more vulnerable to both sleep disturbances and chronic illnesses.

A previous study demonstrated that social participation impacts the reciprocal relationship between SDs and pain by both directly and indirectly affecting depression within the longitudinal CHARLS cohort15. Additionally, Ryu et al. found that perceived levels of social activity are closely linked to the risk of major depressive disorder in older adults, suggesting that active social engagement could potentially alleviate depressive symptoms and influence related health outcomes41. However, in the recent analysis of the CHARLS cohort, the PAS-COVID-19 score, which reflects personal activity during the COVID-19 pandemic, did not mediate the relationship between SDs and pain (p > 0.05). This lack of mediation may be attributed to the decreased activity of participants throughout the COVID-19 pandemic. Recent studies emphasize insomnia’s role in mediating the effects of problematic social media use on well-being, underscoring its importance in understanding the complex relationships between sleep, mental health, and daily functioning during the pandemic42.

This study provides key insights into both the theoretical and practical understanding of the relationship between sleep duration and pain. By demonstrating depression’s mediating role, it highlights the importance of integrated approaches that address both mental health and sleep issues in pain management, especially during public health emergencies like COVID-19. Practically, the findings highlight the potential for clinical interventions that focus on improving sleep and managing depressive symptoms to alleviate pain, particularly in populations with chronic conditions. The study’s strength is its large, nationally representative sample, which improves the results’ generalizability and robust statistical methods, including mediation analysis with bootstrapping, which enhances the reliability and precision of the estimated indirect effects.

Despite the key insights provided by this study, several limitations must be considered. The cross-sectional design limits our ability to infer causality, and the reliance on self-reported data introduces potential recall bias and reporting errors. Additionally, while sleep duration was measured, important aspects of sleep quality, such as insomnia, fragmented sleep, or sleep apnea, were not assessed, which could offer a more nuanced understanding of the relationship between sleep duration and pain. The absence of comprehensive pain assessments, including severity and frequency, further constrains the thoroughness of analysis regarding the pain experience. Moreover, the exploratory nature of this study could be improved through the use of more advanced methods, such as Structural Equation Modeling (SEM), to provide model fit indices and a more thorough evaluation of mediation pathways. Future research must address these limitations by adopting longitudinal designs, integrating comprehensive sleep quality assessments, and applying advanced modeling techniques to understand these intricate interactions better.

Conclusion

In conclusion, this study highlights the strong association between deviations in sleep duration—whether shorter or longer than optimal—and pain, mediated by depression and CDs. These findings emphasize the importance of considering sleep duration as an integral part of comprehensive pain management strategies, including during public health crises like the COVID-19 pandemic. Future research should explore practical applications of sleep interventions in clinical settings to enhance pain relief, particularly among individuals with chronic conditions.