Gaining when I'm good, Maintaining when I'm bad

For the past few months I have found that when I'm good about my calorie intake and stay away from anything that I don't make homemade that's higher protein, less carbs, low/no sugar I gain weight. Then I get frustrated and drink beers, and eat crap and then I maintain my weight. This isn't on a long term basis, it's from one week to the next. I eat really well and gain weight, get frustrated and eat poor and drink beer and then I don't gain anything. This is super frustrating because I'm only about 10 lbs away from my goal. I have lost and gained the same 5-7 lbs every week for months. I go to the gym minimum of 3 days a week and as many as 5 days a week. Mix of cardio & weights, 30 - 60 minutes a day. And no the inches aren't really changing either, in months lost like 1/2 inch here and there.

I'm not really looking for advise on food. I have a pretty good grasp on the fact that I shouldn't be drinking beer and expect to lose weight (though it's also football season so not giving that up LOL). My question is more for anyone out there who was close to their weight loss goal and what they did/how long it took to get the last few pounds off.

I have pushed myself to the mindset that atlest I feel better physically to keep myself going, but not sure that will last forever.