| Objective To explore the influencing factors of nurses’ insomnia, and to test the mediating effect of psychological capital on the relationship between nurses’ occupational stress and insomnia. Methods 810 nurses from a Class ⅲ Grade A hospital were selected by stratified random sampling from March to May 2021. The Effort-Reward Imbalance questionnaire (ERI), Psychological Capital Questionnaire (PCQ) and Athens-Insomnia Scale (AIS) were used to evaluate the occupational stress, psychological capital and insomnia of nurses, respectively. The mediation effect of psychological capital between occupational stress and insomnia in nurses was analyzed by PROCESS mediation test. Results 658 (81.23%) questionnaires were effectively collected. It was found that nurses' effort-reward ratio was positively correlated with AIS score (r=0.379, P<0.01), and negatively correlated with PCQ score (r=-0.275, P<0.01). Nurses' PCQ score was negatively correlated with AIS score (r=-0.402, P<0.01). Nurses' occupational stress could negatively predict psychological capital (β=-11.024, t=-7.324, P<0.01) and positively predict insomnia (β=4.117, t=10.478, P<0.01). Psychological capital could negatively predict insomnia (β=-0.087, t=-9.083, P<0.01). When psychological capital was included as a mediating variable, the predictive effect of occupational stress on insomnia was statistically significant (β=3.158, t=8.185, P<0.01). Conclusion Psychological capital plays a partial mediating role between occupational stress and insomnia in nurses.