Everyone knows that people who chow down on french fries, chug soda and go heavy on red meat tend to pile on more pounds than those who stick to salads, fruits and grains.

But is a serving of boiled potatoes really much worse than a helping of nuts? Is some white bread as bad as a candy bar? Could yogurt be a key to staying slim?

The answer to all those questions is yes, according to the provocative revelations produced by a big Harvard project that for the first time details how much weight individual foods make people put on or keep off.

The federally funded analysis of data collected over 20 years from more than 120,000 U.S. men and women in their 30s, 40s and 50s found striking differences in how various foods and drinks — as well as exercise, sleep patterns and other lifestyle choices — affect whether people gradually get fatter.

The findings add to the growing body of evidence that getting heavier is not just a matter of “calories in, calories out,” and that the mantra: “Eat less and exercise more” is far too simplistic. Although calories remain crucial, some foods clearly cause people to put on more weight than others, perhaps because of their chemical makeup and how our bodies process them. This understanding may help explain the dizzying, often seemingly contradictory nutritional advice from one dietary study to the next.

“The conventional wisdom is simply, ‘Eat everything in moderation and just reduce total calories’ without paying attention to what those calories are made of,” said Dariush Mozaffarian of the Harvard School of Public Health, who led the study published in Thursday’s edition of the New England Journal of Medicine. “All foods are not equal, and just eating in moderation is not enough.”

The findings help explain why many people put on weight little by little over the years without even realizing it. Just by picking the wrong combinations and portions of foods, and making unhealthy lifestyle choices, people imperceptibly enlarge their girth as time goes by, eventually becoming overweight or even obese, the study indicates.

Among all the foods studied, potatoes stood out. Every additional serving of potatoes people added to their regular diet each day made them gain about a pound over four years. It was no surprise that french fries and potato chips are especially fattening. But the study found that even mashed, baked or boiled potatoes were unexpectedly plumping, perhaps because of their effect on the hormone insulin.

Similarly, while it was no shock that every added serving of fruits and vegetables prevented between a quarter- and a half-pound gain, other foods were strikingly good at helping people stay slim. Every extra serving of nuts, for example, prevented more than a half-pound of weight gain. And perhaps the biggest surprise was yogurt, every serving of which kept off nearly a pound over four years.

“The big picture of what’s new and unique here is we looked at multiple things simultaneously. Most studies just focused on one thing or a few things at a time. I wanted to see if you took the whole picture together. That hasn’t been done before,” Mozaffarian said.

The findings could have significant political, economic and policy implications, supporting, for example, growing pressure to levy taxes and take other steps to discourage certain menu options, such as sugary soda for kids.

“I think it’s an important study,” said Kelly D. Brownell, director of Yale University’s Rudd Center for Food Policy and Obesity, who co-wrote an accompanying article. “It’s based on a large number of people followed over time, and it shows there are particular types of food that are contributing more than others to the obesity problem — and that some are protective against weight gain.”

For the study, Mozaffarian and his colleagues analyzed data collected from a total of 120,877 healthy American men and women. The volunteers detailed their eating, exercise and other habits for the Nurses Health Study, the Nurses Health Study II and the Health Professionals Follow-up Study— large, highly respected Harvard studies examining a host of health issues. The researchers followed the participants for four-year intervals to see how changes in what they ate, drank and did affected their weight.

Within each period, the subjects gained an average of 3.35 pounds. Every additional daily serving of potatoes pushed up the scale by more than a pound every four years. As expected, the type of potato, however, was important. Every order of french fries put on 3.35 pounds; a snack of potato chips added 1.69. But even each helping of boiled, baked or mashed potatoes contributed a little more than a half-pound.

Although the study did not evaluate why potatoes would be particularly fattening, other research shows that starches and refined carbohydrates such as potatoes cause blood sugar and insulin to surge, which makes people feel less satisfied and eat more as a result, Mozaffarian said.

Many people might also be surprised that every extra serving of refined grains, such as white bread, added 0.39 pounds — almost as much as indulging in some sweets.or desserts.

Researchers will surely scramble to try to explain why yogurt appears so helpful. It may be because of subtle shifts of microbes in the digestive tract, or perhaps because people who eat more yogurt also tend to do other healthy things, the researchers said.

Lifestyle factors were clearly important. Those who exercised more gained nearly two pounds less than those who increased their physical activity the least. People who slept less than six hours a night — or more than eight hours — were more likely to gain weight, possibly by unbalancing hunger hormones such as ghrelin. Every extra hour per day of television watching added about a third of a pound, perhaps by encouraging snacking.

But some researchers expressed caution.The precise “serving size” varied among foods, and relied on participants’ memory and honesty, for example.

“To attempt to isolate the effect of specific foods on weight changes is fraught with problems,” said Lawrence J. Cheskin, who heads the Johns Hopkins Weight Management Center. “One is that people may conclude that if they simply stop eating X, they will reduce the chance of weight gain. This is unlikely, and a false conclusion.”Similarly, it is likely more a result of people who eat fruit being more health-conscious than fruit per se causing less weight gain.”

Nevertheless, the consistency across all three data sets made the researchers confident that the findings are generally accurate for sketching an outline of which food choices encourage overeating and which are associated with maintaining a healthier weight.

With no magic bullet weight-loss pills in sight, and study after study showing that dieting only helps a little, other researchers said the findings offer valuable clues to the only other option for fighting the obesity epidemic: preventing weight gain.

“What we now need are effective strategies and possibly public health policies to help people adopt lifestyle behaviors that will prevent them from becoming obese,” said Samuel Klein of the Washington University School of Medicine in St. Louis. “An ounce of prevention is worth a pound of fat when it comes to obesity.”