This paper aims to identify the mediating mechanisms of a school-based obesity prevention program (DOiT). The DOiT-program was implemented in Dutch prevocational secondary schools and evaluated using a controlled, cluster-randomised trial (September 2003 to May 2004). We examined mediators of effects regarding (1) consumption of sugar containing beverages (SCB); (2) consumption of high caloric snacks; (3) screen-viewing behaviour; and (4) active commuting to school. To improve these behaviours the DOiT-program tried to influence the following potentially mediating variables: attitude, subjective norm, perceived behavioural control, and habit-strength. Both in boys (n = 418) and girls (n = 436) the DOiT-intervention reduced SCB consumption (between group difference in boys = -303.5 ml/day, 95% CI: -502.4;-104.5, between group difference in girls = -222.3 ml/day, 95% CI: -371.3;-73.2). The intervention did not affect the other examined behaviours. In girls, no intervention effect on hypothetical mediators was found nor evidence of any mediating mechanisms. Boys in intervention schools improved their attitude towards decreasing SCB consumption, while this behaviour became less of a habit. Indeed, attitude and habit strength were significant mediators of the DOiT-interventions effect (4.5 and 3.8%, respectively) on SCB consumption among boys. Our findings imply that interventions aimed at EBRB-change should be gender-specific. Future studies aimed at reducing SCB consumption among boys should target attitude and habit strength as mediating mechanisms. Our study did not resolve the mediating mechanisms in girls. International Standard Randomised Controlled Trial Number Register ISRCTN87127361.