B12 plays a role in melatonin production. Melatonin is the hormone responsible for letting you get a good night's sleep. As we age, the body is less efficient at making this hormone. B12 supplementation has helped some older adults sleep better.