I firmly believe everyone's body responds slightly differently to different weight loss strategies, so what works for most people might not work for all.
Also, my understanding is that current evidence shows some changes in metabolism caused by both gaining weight and by calorie restriction, which causes it to be harder to lose weight once you have gained it.
Still, here is what has always worked for me (losing only about 25 lbs per attempt, which is a lot on my tiny frame, but admittedly might not be what you are looking for here).
First of all, weight maintenance has for me been a matter of eating habits, not exercise (which has fluctuated wildly over the years).
1. I never forbid myself any foods, but I put limits on how often or how much I can eat of unhealthy items.
2. I think in terms of 'nutrition bang/calorie buck'. So if I am in my normal routine, I usually first make sure I've eaten a sufficient amount of healthy food every day before I eat any unhealthy food (e.g., multiple servings of fresh fruit and veggies, a serving or two of healthy fats...mainly olive oil, nuts, and avocado, and 1 serving of lean protein (fish/white meat poultry). Grains, non-fruit sugars, fatty deserts, red meat, dairy, etc., are all 'add ons' that make it into my diet in small amounts 'around the edges' of my daily eating, much like condiments.
3. Similarly, I don't 'waste' empty calories on stuff that I don't love. I don't eat candy just b/c 'it's there'. For the most part, I like candy but don't love it. So I'll go years without eating any candy, no matter how much I encounter it, but I will regularly buy Ben and Jerry's full-fat ice cream (which I LOVE) and eat only 2-3 spoonfuls per day. Or a couple of squares of expensive dark chocolate. If I'm going to waste those calories, I better REALLY enjoy the experience. Or, e.g., I don't love cheese. It's fine, and I will eat it occasionally at parties. But I would never buy it for myself. ETA: Ok, I lied. I love goat cheese in certain circumstances and will buy it occasionally LOL.
4. I routinize my eating a lot, so that I don't spend a lot of time thinking about food. However, I am fortunate in that I love healthy foods just as much as unhealthy, and am totally happy eating e.g. big complex salads every day of the week for at least one meal. Likewise, I'm not terribly prone to 'food boredom'. Your mileage might vary.
5. When changing eating habits, make one small change at a time until it sticks (usually at least 3 weeks), and then make the next change until you have accumulated new eating habits. I know for sure this can be done, b/c I radically revamped my shitty youthful eating habits when I was about 30, and it has stuck for 17 years.
That's about it for food and maintaining my weight.
As to actually losing weight, there is no question what works for my body: Cutting carbs/sugar, and combining that with light strength training and short bursts of high intensity aerobic exercise. Essentially, low-carb w/interval training. I can eat incredible amounts of additional fat or protein calories in this situation, and my body tears through them like a wildfire. It is almost scary.
I found this out by accident when I used to do field work on a topographically challenging Caribbean island. Every day I'd be hiking steep trails in short bursts (hike steep incline as fast as possible for 5 minutes, stop to do surveys for 3 minutes) for hours every day. We had access to TONS of food at this field site, where we were supplied with 3 squares involving multiple courses, and desserts with both lunch and dinner. Plus alcohol in the evening. To sum up: I regularly ate ~3x as much food, and higher calorie food, at this field site as I normally would at home. Unless I made an active effort to eat carbs/dessert every single day, I would drop close to 5 lbs per week at that job. One year I decided maybe I'd skip all the sugary desserts and most of the simple carbs, for health reasons. Result was I went home 3 weeks later brutally thin, with no boobs, and my pants tied around my waist with a bungee cord to keep them from falling off.
Again, this has consistently worked for me throughout my life, including the several occasions I gained 20+ lbs. Your body might function differently in the particulars, though.