Eat less, do more.
DON'T DIET.
Just eat good quality (as little processed) food three times a day, and control your portiions if you have lost the natural ability to know when you've eaten enough (something that happens to many people).
Then grit your teth and exercise more - of course it's boring but it's the only way. If you get out of breath speed-walking the dog, walk a little slower so you don't become winded and allow your body to get used to that effort level before going faster.
Don't expect over-night results, don't set an unrealsitic target weight, realise that if you are in a sedentary job you'll need to be exercising hard enough to feel a little breatheless 3 x 20 minutes minimum a week, or longer periods of less intense exercise.
Oh; does your weight gain match a change in lifestyle? Stress can often cause an increase in weight (due to Cortisole), that's just one example.