I agree with saturn24, it is possible for some people to gain control over the images, I find the best thing to do is concetrate on an image of a loved one, fond meory etc, and just try to block out any unwanted thoughts.
Alsoi I find some soothing music helps me, I normally leave someting very light and airy on quietly in the background like sigur ros, or soft classical music.
Even if it isnt your kind of thing, anything calm in the background has a slight influence over your thoughts, personally I like heavy metal music, but that would just incite too much brain activity to try and carry on sleeping