Public policies that regulate the promotion or sale of unhealthy food and beverages in schools are relevant to prevent obesity in children and adolescents. However, the relationship between food and beverage laws within schools and obesity in Brazilian adolescents needs further study. Thus, this study aims to evaluate the association between laws that restrict the sale of food and beverages in school cafeterias and obesity in adolescents from public and private schools in Brazilian capitals. Data were provided by the ERICA study, which followed a cross-sectional school-based approach. The sample consisted of adolescents aged between 12 and 17 years (n = 19,024) from Brazilian capitals (n = 27) enrolled in schools that sell food and beverages in their dependence (n = 486). The dependent variable was the presence of obesity, and the main effect was the coverage of laws restricting the sale of food and beverages in school cafeterias. Data analysis was carried out using multilevel logistic regression models. Adolescents covered by laws restricting the sale of food and beverages in school cafeterias had an 11 % lower chance of obesity (adjusted OR = 0.89; 95 % CI 0.88 – 0.91). In conclusion, laws restricting the sale of food and beverages inside schools were associated with a decrease in the chance of obesity in adolescents in Brazilian state capitals.