I keep a pad on the nightstand next to the bed, so I can write down all those random thoughts. Once they're written down, I know I'll see them next day when I clear my notes from the pad, and I can go to sleep. It may take a while to get everything out of my head, but it does work to stop the flow of thoughts.
Also, it would be best to spend some time before bedtime quietly doing something that doesn't have a backlit screen (TV, computer, tablet) in front of your face to let your brain wind down from the day.