I've had it like that, where I can't slow my mind down and drift from one ludicrous possibility to the next, or just obscess on something that'll be taking place in the next 24 hours or something. Occasionally it's even gotten out of hand and gone into a mild to moderate anxiety attack. Not to the extreme of not sleeping for 3 or 4 days though, I get myself in order quicker than that.
You have to accept that your mind is going to go a mile a minute and just seize control of the direction. I do things like think about gambling, imagine myself playing blackjack and rolling up a big jackpot, or even shooting. An activity that's repetitive, that you are familiar with enough to go right to it, that is also something you find relaxing. It always basically boils down to math though, counting cards, adding up x rings, but in a more soothing manner.
It WILL lull you right to sleep, you should try it.
If you can't get it in line I'd go see a doctor or maybe even a psychologist.
For what it's worth, a really great bed might also help. Even when I do sleep, it's generally in 45 minute increments. I got a 4 inch memory foam tooper and a feather bed and now I'm getting 4 and 5 hours at a time.