I was diagnosed with Cushing's Syndrome, and my doc believes that this has thrown my system out of whack - especially my thyroid. It's like a vicious circle. Stress affects cortisol, your adreanals get out of line, your thyroid gets wonky, repeat ad nauseum.
For me, having a name for what ailed me was key. I had two docs tell me "It's in your head." And, "What do you expect? You're a busy mom." They didn't even want to check my thyroid saying if I didn't have a goiter, there was no concern. Well, a new doctor (female) and few simple tests proved that I had almost no thyroid and I was in Stage 3 of adrenal fatigue.
My doc put me on Armourthyroid and some other supplements, which has helped tremendously. I follow low sugar/low carbs and it has helped so much. Low GI has been a key to unfogging my brain and keeping energy levels up. My hair is growing back, too.
Reducing stress is also a key component. I do yoga and have some relaxation/meditation apps on my ipod. These aren't enough to stop the weight-gain cycle, but they have helped to greatly reduce my cortisol levels and raise my thyroid. After a year, my life seems more well-balanced and I feel like I am ready to tackle the weight gain issue.
If things don't improve for you with medication alone (which is what happened to me), you might want to have your cortisol levels checked. Just a suggestion. I wish you the best of luck and good health!