Quality of food is more important than quantity for preventing weight gain with the passing years, a study has found.
Small lifestyle changes made the difference between staying slim and becoming overweight or obese, said researchers.
Diet had more of an impact than physical activity, watching TV or sleep duration. But focusing on calories alone was not the best way to stay slim, according to the scientists.
The secret was to focus on the quality of foods, especially carbohydrates.
Weight-watchers were advised to cut out sugar-sweetened drinks, potatoes and refined grain foods such as white bread, white rice and low-fibre breakfast cereals.
At they same time they were urged to eat more 'natural' foods, such as fruit and vegetables, whole grains, nuts and yoghurt, while avoiding anything processed.
"These findings underscore the importance of making wise food choices in preventing weight gain and obesity," said Professor Frank Hu, a nutrition expert at the Harvard School of Public Health in Boston, US.
"The idea that there are no 'good' or 'bad' foods is a myth that needs to be debunked."
The findings, published in the New England Journal of Medicine, also showed that getting the right amount of sleep helped people maintain a healthy weight.
People who slept six to eight hours a night gained less weight than those who slept less than six or more than eight hours.
Prof Hu's team analysed results from three large-scale studies of US health workers, the Nurses' Health Study, the Nurses' Health Study II, and the Health Professionals Follow-up Study.
Together the studies monitored the health of more than 100,000 individuals for up to 20 years.
All were initially free of chronic diseases and not obese.