BackgroundShift work can disrupt sleep quality and gut health. Nurses and midwives constitute approximately half of the global healthcare shift-working workforce. Our previous study revealed that most midwives were experiencing suboptimal health conditions, characterized by poor sleep quality and a high prevalence of gastrointestinal diseases. The gut–brain axis theory highlights the potential interplay between sleep quality and gut health. However, limited research focuses on this relationship among midwives.MethodsA cross-sectional survey included 2041 midwives from 87 Chinese hospitals between March and October 2023. Participants completed standardized questionnaires assessing sleep quality, gut health, depression, anxiety, and work stress. Binary logistic regression analyzed factors associated with poor sleep, and multiple linear regression examined the influence of sleep quality on gut health.ResultsOver 60% of midwives reported poor sleep, with many experiencing gastrointestinal disorders. We observed a bidirectional relationship between sleep quality and gut health among midwives. After multivariable adjustments, midwives with higher gut health scores were more likely to experience poor sleep quality (odds ratio = 1.042, 95% confidence interval = 1.03–1.054). Conversely, midwives with higher sleep quality scores were also more likely to have poor gut health (β = 0.222, 95% confidence interval = 0.529–0.797). These associations remained robust across sensitivity analyses. Furthermore, depression, anxiety, and work stress significantly affected both sleep quality and gut health among midwives.ConclusionThis study enhances our understanding of the intricate relationship between sleep quality and gut health among midwives. Poor gut health was associated with a higher risk of poor sleep, and vice versa. To improve the overall wellbeing of midwives, the findings emphasize the importance of addressing poor sleep quality and promoting gut health through maintaining a healthy diet, lifestyle, and good mental health. Further studies are needed to confirm our findings and clarify the underlying mechanisms.