Background Objective of the current study was to determine which of thirteen specific psychosocial work factors were related to number of musculoskeletal pain sites (NPS) prospectively over a two-year time span. Furthermore, the study aimed to explore possible mediation of these prospective relationships through sleep problems. Methods The study was a two-wave full panel study. Participants included 6277 employees of Norwegian companies, representing a wide range of occupations. Structural equation modelling was employed to analyze direct and indirect effects of thirteen specific psychological- and social work factors on sleep problems and NPS. Results Out of the thirteen work factors studied, positive challenges at work, role conflict, decision control, superior support, coworker support, empowering leadership, and social climate were statistically significantly related to subsequent NPS, both directly and indirectly through sleep quality. Sleep quality was related to NPS in all analyses. Most psychosocial work factors exhibited direct effects on either sleep or number of pain sites. Decision demands and control over work pacing were not statistically significantly related to sleep or pain. Conclusion In conclusion, the results suggested sleep quality to be involved in the mechanisms by which work affects the number of pain complaints employees experience.