As you mentioned stress and insomnia and having nightmares are closely intertwined. To avoid nightmares, some people superficially take sleeping pills, which I believe, could exacerbate the situation.
Practicing meditation before going to bed is a reliable technique to calm you down and deepen your sleep.
However, I think you can never turn off your thoughts completely. You can filter out negativity, though.
- after ‘would’ and other modal auxiliaries, always use bare infinities.
- Insomnia is uncountable.
- after a few times
- I suffered
- turn off my thoughts