If you’re taking vitamin D too close to bedtime, it may affect your sleep quality, as high amounts of vitamin D in the body may interfere with the production of melatonin.
However, other studies suggest that having a low amount of vitamin D in your body may lead to a higher amount of disturbances, and reduced sleep quality and duration.
It’s probably easier to take your vitamins along with your morning meal, but until there is concrete evidence, experiment and find a routine that works best for you.