Both musculoskeletal pain and sleep disturbances are major health problems worldwide. Literature suggests that the two are reciprocally related and both may be associated with changes in C-reactive protein (CRP) levels. However, the relationships among musculoskeletal pain, sleep duration, and CRP remain unclear. In this cross-sectional study, we investigated the relationship between acute and chronic musculoskeletal pain, sleep, and inflammation using the data from the initial visit of the UK Biobank. 17,642 individuals with chronic musculoskeletal pain, 11,962 individuals with acute musculoskeletal pain, and 29,604 pain-free controls were included in the analysis. In addition, we validated the findings using data from the second visit assessment of the UK Biobank. We found that 1) chronic pain was associated with higher CRP levels compared to both acute pain and the pain-free controls; 2) chronic pain was associated with a lower sleep score (a measurement of sleep patterns), compared to acute pain and the pain-free controls; and acute pain was associated with lower sleep scores compared to the controls; 3) there was a significant negative association between the sleep score and CRP; 4) CRP may partially mediate the association between chronic pain and decreased sleep score. However, the effect size of the mediation was rather small, and the pathophysiological significance remains uncertain. Further validation is needed. These findings were partly replicated in the UK Biobank second visit assessment cohort with a smaller sample size. Our findings, which are based on the large UK Biobank dataset, support the interplay between musculoskeletal pain, sleep patterns, and the potential mediating role of CRP on this reciprocal relationship.