Bedtime depression is the worst

During day time, I’m relatively better at handling with depression or anxiety. But when I’m on bed and trying to fall asleep, intrusive thoughts come out of nowhere and can’t make myself relaxed. What should i do to actually make night time more relaxing and having rest?