Sugar does not make a person gain weight.
Consuming too many calories is what causes a person to gain weight, regardless of where the calories are found.