Lack of sleep is associated with weight gain.
Have you been following a diet strictly, going to the gym, tracking all your calories, yet you still gain weight? The answer could be that you are not getting enough sleep.
Even if you follow a great diet and fitness regimen, your body will not be able to burn fat at its optimal rate if you are not allowing it to "restart" sufficiently. If your body does not have enough energy, of course it will not be able to follow out all its functions properly. So, ensure that you are getting enough sleep and prioritize those ZZZs just as much you would gym time or healthy eating because studies have shown that it is just as important. You know all those people that eat a bunch of junk food, never go to the gym, yet maintain the physique of your dreams? There's a good chance they are getting enough sleep every night to even it out.