Slap Yourself Awake

Bob is on a stakeout. He's been chasing the bad guy for three days straight with no sleep. If he can catch him after this deal is complete, the bastard's going down. But he's so-o-o tired. Desperate to stay awake, he takes out a knife, slices his arm a bit, and then pours the whisky from his flask on it. The pain keeps him in the game for another round.

Or Alice is trying to escape from the lair of the psycho killer. She's been battered about the head several times and is seriously woozy. To keep from passing out, she grinds her fingernails into the wound he's inflicted on her side. She has to clamp her other hand over her mouth to keep from crying out, but she's definitely awake now.

Nothing wakes you up like a nice hot cup of PAIN! Basically, a character in a dangerous situation is exhausted, ill, drugged, whatever. In order to stay awake, he deliberately causes himself pain. Bonus points if the character pinches or otherwise inflames a wound inflicted by whatever he's trying to escape.

Compare Pinch Me, except that, instead of trying to establish reality this character is trying to remain firmly grounded in it. Can also be related to Beat the Curse Out of Him, except the beating would be self-inflicted.

Comic Books

 * XIII slices his palm while drugged on a sinking ship to stay awake.
 * Arkham Asylum a Serious House on Serious Earth: Batman stabs his palm with a shard of glass to wake himself up from the disturbing experience of being psychoanalyzed by The Joker.

Film

 * In The Ipcress File, the hero gets captured and is tortured by being subjected to a machine that messes with his senses and will eventually brainwash him into a Loss of Identity. Eventually, he finds a sharp piece of wood and squeezes on that while being tortured, as the pain distracts him enough that the process doesn't work.

Folklore

 * In one Japanese folktale about an evil vampire cat (bakeneko) disguised as a woman who lulls her "husband" and his guards into sleep so that she can feast on him, a heroic samurai manages to stay awake by cutting himself with his own katana.

Literature

 * In Stephen King's short story "The Gingerbread Girl", the heroine bites down on her injured lip to keep herself from passing out when she should be trying to untie herself.
 * Near the beginning of White Fang, a drowsing character attaches a burning stick to his hand to keep from falling asleep, since he's surrounded by wolves and if the fire goes out, he's Wolf Chow.
 * The Silver Chair: Puddleglum employed this technique when he stomped out the fire that the Lady of the Green Kirtle was using as part of her hypnotic magic. Not only did it quash the aroma that was lulling the heroes into a trance, but the pain (he was barefoot) is specifically said to give him a moment's perfect clarity.
 * The Horror Of The Many Faces: Dr. Watson pinches himself to avoid passing out from shock after witnessing Holmes brutally murder and mutilate a man.

Live Action TV
""I'm awake. You can stop any time now.""
 * Myth Busters: Slapping awake was proved true. Apparently it even sobers you up a bit.
 * Used in Legend of Sword and Fairy when the heroes are battling the effects of magic soporific smoke. The hero bites his companion to wake her up. She promptly returns the favor.

Manga and Anime

 * In X 1999, Karen drugs Aoki in order to take his place in an upcoming duel she believes he won't survive. Aoki stabs himself in the leg with a kitchen knife to keep himself awake long enough to stop her.
 * Naruto: A common way to snap out of illusions is to injure yourself.
 * A variant occurs in Trigun, where Vash concentrates on the pain from his previously injured finger to counteract a villain who uses hypnosis to paralyze people.

Video Games

 * Floyd: When you are trapped in the re-education center, your actions are controlled through hypnosis and drugs, and your every move is monitored. In order to try to escape, you need to take a pin and leave it in your bed, causing you to wake up out of schedule.
 * Star Control II: The Urquan were mind-controlled slaves of the Dnyarri, until they discovered that extreme pain would force the Dnyarri to disconnect from their minds temporarily. They then invented a device to cause themselves constant agony, and rebelled and slaughtered their former masters.

Western Animation

 * The Simpsons: Bart Simpson smacks himself to stay awake studying in the episode where he actually buckles down and tries to get a passing grade.
 * This is a mini-game in Konami's The Simpsons arcade game, after the Inevitable Waterfall.
 * Generator Rex: In "Plague", Holiday uses a series of low-level elecrical shocks directly to her brain to keep herself awake after the eponymous plague causes everyone else in the world to fall asleep.
 * The Harlem Globetrotters did this in one episode of The New Scooby Doo Movies.