Yes I get that "racing brain" problem from time to time, and it does keep me awake.
Cutting out caffeine during the evenings seems to help, also a bit of physical exercise is useful.
I try to discipline myself into avoiding too much intense thinking for an hour or two before bed, but it's not always easy, my mind seems to have a mind of its own, and if it wants to ponder stuff intensely, it just does.
Meditation seems to help, as long as the urge to think isn't so great as to overwhelm my efforts. I focus on my breathing and try to think of nothing else but the air going in and out of my nostrils.
I suspect that stress and worry has something to do with it, so I try to keep my stress levels down during the late evenings. Usually that's a matter of coming home early-ish if I'm out, and avoiding worrying thoughts.
It's probably worth doing something artistic before bed. In my case that's music.
It might also help to keep the lighting subdued.
Personally I can't sleep easily if I'm hungry, so I eat a good supper.