Adolescent loneliness and poor mental health represent dual public health concerns. Yet, associations between loneliness and mental health, and critically, how these unfold in school settings are less understood. Framed by social ecological theory, this study aimed to identify key predictors of adolescent mental health, and examine school-level variation in the relationship between loneliness and mental health.Cross-sectional data on adolescents from the 2018 wave of the Health Behaviour in School-aged Children study (HBSC) in Scotland were used (N = 5,286). Mental health was measured as a composite variable containing items assessing: nervousness, irritability, sleep difficulties and feeling low. Loneliness was measured via a single item assessing how often adolescents felt ‘left out’. Multilevel models were used to identify key social ecological predictors of mental health, associations with loneliness, and between-school variation.Loneliness, as well as demographic, social, and school factors, were found to be associated with mental health. Schools accounted for around 8% of the variation in adolescents’ mental health, and the between-school difference in mental health was greater among adolescents with high levels of loneliness. Additionally, the negative effect of loneliness on mental health was stronger in schools with lower average mental health scores.The findings suggest that schools can play an important role in shaping adolescent mental health. Our study uniquely identifies that school-based interventions targeting mental health may be especially necessary among lonely adolescents, and programmes aimed at tackling loneliness may be more beneficial in schools with poorer mental health.