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.

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.
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.

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.

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.

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.

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).