Get sleep before driving. Trust me. About two months ago I asked for guidance on the same thing- I *was* going to get some sleep prior to driving, but we lost track of our other friends and my friend was rolling far too hard to risk leaving her alone.
I took a road I hate driving on just to get to bed faster. I pulled over twice so I could stretch and wake up a bit. That was not a fun drive, and if it was normal traffic conditions, rather than the typical emptiness of that time of morning, there would have been a damn good chance of an accident. Looking back, I should have called my mom and told her her car wouldn't be back for a while and I was taking a nap before coming home. It was not a fun experience. I had to actively focus much harder than I normally do to drive even half as well as I normally do. While there was no way I could have just left my friend alone inside the party, we should have stayed in the car for a couple hours to sleep. If you can't sleep in the car, find a friend in the area to provide crash space or get a hotel room.
I'd say a *minimum* of 6 hours between dropping the pill and getting behind the wheel, and at least two hours of sleep at the end of that. YMMV, but I'd recommend that as an absolute, unbreakable even on the command of the Almighty, minimum. More time to sober up and more sleep would be ideal. And if you feel the slightest bit high, wait until its been at least an hour or two since you started feeling completely sober.
Nothing kills a good time like bouncing off a guard rail, to say nothing of killing other people and going to jail.