This is a common misconception, let me explain.
> Losing weight and gaining weight is simple physics.
> you are losing weight because you are consuming less calories.
This is only true in the first up to 6 months of a calorie-restriction diet. Then, body adjusts its metabolism (lower body temperature, making you feel more lethargic to keep you from exercising, etc) and your weight begins to slowly climb back up, sans any further calorie restriction. At this point, it's easy for a dieter to blame himself of lacking willpower: "it worked, and it stopped working now, I must've been not strict enough!".
The same thing happens if you force someone to overeat even if they're not hungry. They will gain weight -- for up to 6 months. Then, the body increases its base metabolic rate and adjusts to the new food intake level.
As Dr. Jason Fung meticulously explains in his book Obesity Code, there seems to be a weight set point. He then argues that the root cause of obesity, and the body's set weight point, is insulin resistance.
The books hails your grandma's advice: "Cut back sugars and starchy foods. No snacking."
This is from the last part (The Solution):
1. Reduce your consumption of added sugars.
2. Reduce your consumption of refined grains.
3. Moderate your protein intake.
4. Increase your consumption of natural fats.
5. Increase your consumption of fiber and vinegar.
The author also stresses the importance of fasting.
Everything the book asserts seems to be pretty well backed by science, go check for yourself.
Source: Obesity Code by Dr. Jason Fung. Read it, it's not only a brilliant weight loss book, but also a wonderful book about how the wrong incentives for companies have led to the obesity epidemic in the US.