First things first: taking a melatonin supplement does not cause weight gain. In fact, taking melatonin has been associated with lower body weight (6).
What is a concern, however, is whether melatonin deficiency can cause weight gain. Research has indicated a correlation between low melatonin levels and weight gain. In a 2014 study, low levels of melatonin were associated with a higher appetite and an increase in weight. Interestingly, the participants were able to lose weight again when they began taking a melatonin supplement (7). Another study, conducted on lab rats, found that low levels of melatonin can interfere with your body’s fullness signals, increase your cravings, increase your weight, and prompt you to eat more (8).
Of course, preventing this problem begs the question of why you might have low melatonin levels in the first place. There are a whole host of possible culprits. Screen time late at night can throw off your circadian rhythm (9). Illnesses and conditions like dementia, mental health issues, cancer, type 2 diabetes, and more can decrease melatonin levels (10). On top of that, melatonin naturally decreases with age (11)! So you may owe your melatonin deficiency to the simple passage of time.