Abstract
This study draws on data from 54,102 eighth-grade students across 717 middle schools in Shanghai, China, to examine the relationship between sleep duration and academic performance across subjects. Sleep duration was self-reported as average nightly sleep on school days, and academic performance was assessed through standardized subject tests administered in the same semester. Using OLS regression, threshold models, and Shapley value decomposition, we found that around 8 h of sleep was most strongly associated with higher academic performance, particularly in mathematics and science. The positive association was more evident among lower-achieving students. Girls generally required slightly longer sleep than boys to achieve their best performance in most subjects, except mathematics. Additionally, homework time and electronic device use were significantly linked to reduced sleep duration. These findings underscore the importance of adequate sleep in supporting adolescent learning and suggest that interventions should address sleep habits alongside academic demands in high-pressure educational contexts.