About what you think before you sleep, about it your subconscious, mind, etc .. engaged in all night.
So, it depends what is in your mind before you fall asleep.
See The Tibetan Yoga of Dream and Sleep, or translantion Egyptian and Greece magic papyri, and there are some other texs.
Try done a meditation every evening beforre you sleep, about what you want. About what do you like. And when are you dreams really bad, sou about a good higher spiritual being.
It could help you.