Yeah, night is probably the worst time of the day for me mentally speaking. I should perhaps count myself lucky that my depressive and/or anxious thoughts are never those of such strength that my sleepiness cannot conquer
Edit: To add to what others have said in this thread, op, mindfulness is important. There's a really good book, Feeling Good by David D. Burns, that goes into the sort of mental distortions that make us perceive ourselves and our world as worse than we/it actually are/is, and how to correct it. I may not follow my own advice 100%, but it's important to take control of your own thoughts to see yourself and your value as it truly is. Of course, if you can afford it, and you can find a good one, therapy helps!