Not having enough vitamin D is connected to feeling sad and can also mess up your sleep. Vitamin D affects chemicals in your brain, like serotonin and melatonin, which help with mood and sleep. Some research even says that vitamin D is part of how your body makes melatonin, the hormone that keeps your body’s daily rhythm in check and helps you sleep well. So, having the right amount of vitamin D can be good for your mood and help you sleep better.