So how do you do it? How do you stop thinking about plot and dialogue and actually, like, get to sleep? It doesn't help that some of my best ideas come then, and are forgotten by morning. But if I were to get up and write them down, I would never get to bed!
Try repeating a sentence to yourself, before you go to sleep, or fall asleep saying it. Any kind of sentence that puts your mind at rest, with your writing or story. I think a positive one, will definetly do the trick. Something like 'I have faith in my story' or 'I am free in my plot'. As you fall asleep you will relax, with the mental understanding that your story/writing is fine, because you are happy with it, and your ideas will re-surface upon that realisation.
If that doesn't work, don't stress. Just keep in mind, to relax and take your time with your best ideas. Do something physical before falling asleep something that'll make you feel good, at the same time make you feel like you need a hundred years rest. When you awake depending on how used to physical exercise you are, you'll either feel more tired or feel better. Hopefully the feeling better one will be your choice, so much so it'll make you alive with new ideas-and even better ones you hadn't thought of before.
Ok so back to reality, it's your choice whatever you do.
Just feel and think it's your story, so you should be able to learn how to create it in the best light you see fit.
Good luck, whatever you do.
