Excessive consumption of ultra-processed foods is associated with the development of metabolic changes in children and adolescents. However, the consumption of total sugars, monosaccharides and disaccharides present in these ultra-processed foods and other food groups and its association with anthropometric indicators must be evaluated. Therefore, this study aimed at analysing the influence of sugar consumption from foods with different degrees of processing on anthropometric indicators of children and adolescents after 18 months of follow-up. This cohort study was conducted among 492 children and adolescents aged 7–15 years. Information on food consumption and anthropometry was collected during three follow-up stages. NOVA classification was used for food categorisation. The influence of sugar consumption on the variation of anthropometric measurements over time was evaluated using generalised estimation equation models. During the analysis period, for each increase of 1 g/d in the consumption of total sugars and monosaccharides from ultra-processed foods, there was an increase of 0·002 kg/m2 (P = 0·030) and 0·001 kg/m2 (P = 0·019) in BMI/Age; increase of 0·073 (P < 0·001), 0·032 (P < 0·001) and 0·100 (P < 0·001) in the BMI/Age z-score; and increase of 0·001 cm (P = 0·001), 0·001 cm (P = 0·003) and 0·003 cm (P < 0·001) in waist circumference, with the consumption of total sugars, monosaccharides and disaccharides, respectively. Our study findings support the evidence that the consumption of total sugars, monosaccharides and disaccharides from ultra-processed foods is associated with weight gain and abdominal fat in children and adolescents, which may represent an important risk factor for excess weight in this age group.