During the day, "write out your nightmare, remembering the early details. But near the end of the story, during the most frightening part, create a non-scary ending."
Now you have a story that starts out like your nightmare, but has a safe ending. Visualize this story a few times a day. When the story appears in your nightmare, the ending should change to be more like the one you’ve created.
This may extinguish the nightmare over time.