Lack of sleep will also cause weight gain. It causes stress, which induces cortisol release. And coritsol will make you retain water. If you're eating lots of carbs (which absorb/retain water) along with that, that's a certain recipe for weight gain.
I saw this in an IF group I follow the other day: