Also, Fridge Logic plays this straight in the movie, where Kyon implicitly (but necessarily) deletes all of the people in the alternate reality by choosing to revert to the original one.
The title character of Battle Angel Alita is trapped in a Lotus-Eater Machine and shown an idyllic alternate world with Ido and a friendly Desty Nova. She breaks free after a while despite regrets about no longer being with Ido.
In the Axis Powers Hetalia fanfiction ''A Dream is a Wish your Heart Makes'', Denmark is put in a Lotus-Eater Machine dream world, because of the Black Mercy plant infecting him. At one point, he becomes vaguely aware that he's in a dream, during a nearly successful attempt by the other nations to remove the plant. When the attempt fails and the dream world is stabilized, the dream version of Iceland pleads with Denmark to stay with him forever, because the plant needs Denmark to stay asleep to continue to feed off of him. Iceland creepily reminds Denmark of this promise towards the end, when the nations dose him with LSD to try to scare him awake, and the dream world gets really freaking terrifying.
In the My Little Pony: Friendship Is Magic fanfic The Perfect Little Village of Ponyville, it’s revealed that the main six (plus Vinyl Scratch) are all stuck in a dream of Twilight Sparkle’s. For them, Twilight waking up is the safest way to get out of the dream, but the actual dream constructs will cease to exist when she wakes. On the other hand, Spike is the only one of these constructs to gain self-awareness—and he’s the first person to figure out it’s all a dream, when Ponyville and its residents begin to fade from existence because none of the dreamers are there. Dream Spike ends up performing an unrelated Heroic Sacrifice, so the moral complications of waking up from the dream become a moot point.
Vanilla Skyends with the revelation that most of what happened in the movie was All Just a Dream and the main character, David, had been cryogenically frozen and put into a permanent state of lucid dreaming. The dream turns into a nightmare and the protagonist ends up accidentally murdering his girlfriend. When he realizes it is a dream, he is given the choice to start over again with everything happy again, but chooses to wake up instead. His girlfriend appears and he realizes that though he didn't really kill her, she has long since died of old age. However, it is hinted at that they will see each other again as she says she has something to tell him "in the next life, when we are both cats."
When the Lotus-Eater Machine was revealed, a psychologist, David's only confidante, argues vehemently that he is not a figment of David's imagination. The dream technician explained to David that he shouldn't feel bad for him, because he is just a superficial character inspired by a movie David once saw. This was proven when the psychologist was unable to recall the names of his two beloved daughters, because David had not thought of them.
Implied to be the end for the original Total Recall (1990). The movie is deliberately ambiguous, although hints like "Blue skies on Mars?" before Quaid goes under imply most of the movie has been a trip into a Lotus-Eater Machine with some very unpleasant brain damage for Quaid (i.e. a "schizoid embolism" according to one of the characters).
Inception has two or three variations: To a lesser extent, the projections who attack any foreign entity in the dream when the host starts to realise he's dreaming; played much straighter, however, is Cobb's projection of Mal, particularly at the end within limbo and inverted with the real Mal, who was convinced that what Cobb thinks is the real world is a dream, and that she needed to die to return to "reality."
In the Tim Burton version of Alice in Wonderland, the Hatter mentions this possibility to Alice, saying that if she is dreaming it all, then he must not truly exist. He doesn't seem too concerned about it however, even half-jokingly telling her that she must be a little crazy to have imagined someone like him. (Which she doesn't deny.)
Played with in Alice Through The Looking Glass. Tweedledum and Tweedledee tell Alice that she (and they) are just characters in the Red King's dream, and that when he wakes she will disappear like a candle flame after it goes out. This in a story that is supposedly Alice's dream.
Alice at one point gets fed up with this whole concept, and considers waking him up just to see what will happen. (She doesn't get a chance to.)
Though she's left idly wondering at the end if her cat Dina's kitten, the "Red King" behind the looking glass, is still dreaming, and if she and the real world are just part of his dream.
In a takeoff of the above, there's a cult in The Man With the Golden Torc who alter reality by telling the severed, dreaming, drugged up head of their college professor what to dream, calling him The Red King. Though apparently not the whole world was his dream, just the cult, and when he is awakened they all wink out of existence.
As the World of Dreams is a constant force of Robert Jordan's The Wheel of Time series, it's only natural for this to crop up throughout the story. In fact, it's revealed that every Aes Sedai is forced to undergo this (THREE TIMES, no less!) when progressing from Novice to Accepted of the White Tower. Even worse, almost every time we see it happen, the results persist somewhat.
Some versions of the Mythos put Azathoth in the role of the dreamer, with the whole universe as his dream. Pray he doesn't wake up.
Philip K. Dick's short story, The Electric Ant, plays with this. The main character finds that his reality is simulated by punchholes in a magnetic tape reel in his chest. He wonders whether the world would fade away if he cuts the tape. He cuts the tape. The next scene is narrated by his wife beside his dead body and she discusses how ridiculous his delusion was. Then she starts fading away.
In Andre Norton's Ice Crown, Shambry threatens this: he is keeping the queen asleep because if she wakes, they will all vanish as her dream. Imfray's men are frightened, but Imfray himself sees he's lost his mind and stops him, breaking the mind-globe controlling her.
Live Action TV
Smallville, Lexmas. Lex Luthor is in a coma and dreams about a "perfect" life in which he is married to Lana, with a boy and expecting a girl; Clark is marriedto Chloe instead, and Clark is perfect about it. He broke off from his father and his ambitions, making them not very rich but very happy. Jonathan Kent becomes senator instead, and announces that Lex is receiving the Kansas Humanitarian Award, and, of all people, says that Lex is the finest man he ever knew. He marvels that he has never felt happier. His mother's ghost informs him that this can be reality if he makes the right choices. The apocalypse rolls by as Lana starts losing blood heavily after delivering the baby girl. Lex begs his father to let Lana get the best treatment, but he cruelly denies it as in reality Lionel orders a risky operation to be done on Lex. He breaks down in the dream world and wakes up in reality.
Life On Mars ended on this trope - wake up from his coma and go back to being chief inspector, or stay with Annie and Gene in the dream world. Sam wakes up, then changes his mind and jumps off a building, returning to the dream.
Inverted in Ashes to Ashes, where Series 2 ends with Alex waking up in the real world... but Gene Hunt is still there and trying to wake her back up into the 80's.
In Series 3 it is hinted at / revealed (depending on your point of view) that she never woke up at all, but dreamed it within her dream.
Used by The Twilight Zone episode "Shadow Play": a murderer tries to dodge the electric chair by claiming that the whole universe is just a dream of his, and killing him will end the dream. Turns out, he's absolutely correct, the world is just a nightmare of his - a recurring one, too.
In the 1980's episode "Nightcrawlers", the characters from a sleeping man's nightmares come to life and wreak havoc. When the monsters accidentally kill the sleeping man, they all vanish.
In Doctor Who, when Donna is caught in a Lotus-Eater Machine in "Forest of the Dead," she starts panicking when she realizes that her two children don't actually exist. Then they start saying, "When you're not looking, we disappear." And then the entire world goes white and she's shown desperately trying to hold onto her husband, who might not be real either. Turns out, he is real, but she just doesn't know.
This shows up repeatedly in Star Trek in various ways.
This served as a motivation for the Hologram of Professor Moriarty who, upon learning what he was, took the ship hostage and demanded that the crew find a way to make him permanently real. They eventually do, for a certain definition of real.
And then there are the people from Barclay's simulation...
Star Trek: Deep Space Nine episode "Shadowplay" featured a lone village on a planet with no other humanoids. And people were disappearing one by one Turns out they were all holograms and the holoprojector was malfunctioning. When they learn the truth, they agree that the machine will be switched off temporarily for repair... and then we get another twist- One of them is real!
In Star Trek: Voyager much of the plot lines revolved about the holographic doctor who knows perfectly well he's just a program, and at some point suggests that he should be restarted to function again, even though this will kill (reset) his individuality.
Another episode featured a villain who was the personification of fear. He could only exist inside the minds of individuals with their brains wired into a computer. If they are disconnected, he will cease to exist. He is defeated when Captain Janeway tricks him into freeing the others in exchange for her mind. The twist is that she was only a holographic projection, so the villain died when everyone was released.
Canadian kid drama The Odyssey featured the hero falling into a coma and arriving in a dream world that reflected his mental state. Oddly enough, even after he woke up, the parallel world continued on without AND with him, complete with a dream version of himself continuing to live there.
Dollhouse provides an interesting example of this with the imprinting and wiping of the actives. It's even lampshaded by the "Did I fall asleep?" dialogue whenever actives return from an engagement.
Further lampshaded at the beginning of Season 2. Dr. Saunders learns that she is actually Whiskey, a scarred - and therefore otherwise unusable - active imprinted semi-permanently as the Dollhouse's physician. When Topher points out that she could have chosen to be 'fixed' - via wipe - at any time, she replies, "I don't want to die..."
The djinn episode of Supernatural, "What Is And What Should Never Be" features this, as there's a period where Dean still thinks his resurrected loved ones are real, but increasingly believes that the only moral thing to do is take his wish back because of all the lives his happiness costs. Ultimately he suicide-escapes.
There are certain beliefs in Hinduism that the universe is a dream of either Brahma or Vishnu, and if he ever wakes up... To outsiders, it sounds terrifying, but to those who believe this, it isn't scary. Hinduism believes in Eternal Recurrance. The god will sleep again, and you will be again.
You're not told this at first, but in The Legend of Zelda: Link's Awakening, your ultimate objective is to trigger one of these. The entire world is, in fact, the Wind Fish's dream. Adding insult to injury is that the people of the island are completely oblivious to this truth, but the villainous Nightmares aren't, and they are, in fact, trying to save the world they took over. But when the Dream Apocalypse happens, there are two who leave the dream world with you: the Wind Fish, whom it turns out you've been sharing this dream with; and (if you win without dying) potential love interest Marin, who gets her wish of flying to far-off lands and singing... as a seagull.
The manga version develops this angle a bit more, with Link fully realizing what will happen and actually abandoning his quest when he learns about the dream world, only for Marin (who doesn't know the truth but had her own issues with dreams) and the Exposition Fairies (who do know) to encourage him to get back on track.
Subverted in Eternal Sonata. Chopin is dying, and enters the game world on his deathbed. Throughout the game, he insists that the entire world is his dream. At the end, in order to prove it's his dream and not reality, he decides to kill the entire party. It doesn't work.
An interesting case occurs in Final Fantasy X The main character Tidus witnesses the destruction of his home city and is swallowed by a gigantic monster, but when he wakes up he finds himself in a fantastic world that is supposedly the future, 1000 years after his city was destroyed. In an interesting twist, Tidus is not the dreamer and his adventure a dream. While the city did exist and was destroyed 1000 years ago, the city Tidus is from is a dream of the few survivors of the destruction, who have put themselves into eternal sleep so their memories of the city are never forgotten. Tidus is just a part of this dream memory, but has been projected in physical form into the dream world. To end their dream, as they request, would mean an apocalypse and suicide, but somehow he gets a vision of an afterlife of some sort, with his father, who was also a dream denizen made real. Fully completing in the sequel results in his living as a normal person.
In the Touhou fan-game Concealed the Conclusion, Gensokyo is a dream of Reimu Hakurei, and will cease to exist when she wakes up. In the Good End, it is revealed that the game's protagonist (Marisa Kirisame) is also from outside Gensokyo and is sharing the same dream.
In the Extra and Phantasm Stages, Suika Ibuki managed to survive Gensokyo's destruction, and has started putting the world back together again piece by piece.
The indie game Oracle of Tao has this played perfectly straight. The world is split into a world of existence (the New Earth), and nonexistence (the Void). Everything in the Void except inside towns has No Ontological Inertia, and just gets swallowed up after 24 hours. If the "real world" exists and the mirror of the real world doesn't exist, what does that really say about the whole? It "sort of" exists. At the end of the game, it turns out God has been sleeping the whole time, and when God wakes up, everything but the main character will wink out of existence (don't ask about the main character).
In the Game Gear version of Ristar, one of the bosses seems to be a dream master. When he is beaten, the background, which was a fairly normal world becomes overrun with lightning and storm clouds, thus hinting at what happens to the world Ristar is in when he beats the boss.
In Fear Mythos: The RPG, it is revealed that all the creatures, Fears, that you thought you were fighting for real, were actually twisted trials by a Fear called THE REVERIE, who placed you in a coma.
In Twisted Metal 2, Roadkill/Marcus Kane's ending is him claiming the game is just him having a bad dream and wishes to wake up from it, Calypso responds that "He would be the one to figure it all out", then gladly agrees, but not before telling Marcus to "Feel free to visit any time, for the rest of your friends will be here for quite a while!", soon after, Marcus awakes in a hospital, surrounded by his family, apparently having survived a 15 car pile-up, with the other contestants being in the other beds by him. However, at the end of it, Calypso's evil laughter is heard. So is it a Dream Apocalypse within a dream? Or an illusion?
Played with in Ultima VII: Serpent Isle, there's a town that was shoved into the dreamworld after an evil sorcerer's magical experiment went awry.
In Drawn to Life: The Next Chapter, where the whole damn world is revealed to be The dream of a boy in a coma. When going home from the fair, the car he was in was involved in an accident which killed his parents. And it turns out he has a sister named Heather with a bandage across the left side of her face - the area where Raposa!Heather had the darkness. And to top it all off? The Raposa are based off the toys he and Heather won at the fair - Mari and Jowee.
One of the episodes of Night Springs in Alan Wake discusses this subject. A man has entered his own dream, only to find many other people conspiring to keep a man asleep. It turns out that it's all a dream within a dream, and that if this man wakes up too suddenly, everybody in the dream will be wiped out. The show ends as an alarm clock sounds.
The DLC "The Writer" also uses this. Both DLC episodes take place in Alan's dreams as he tries to wake up to avoid being driven mad from isolation. Along the way, you're helped by a dream version of your friend Barry...who then becomes the final boss to keep you from waking up.
Glitch -the world, the players, everything- took place within the dreams of 11 Giants. The real life shut down of the game was explained as the Giants waking up.
EarthBound has Magicant. "Take your time, because this country's going to disappear when you wake up."
Defied in Homestuck. The dreamself and dream bubble mechanic aside, there was at least one character explicitly stated to be the creation of Jake's subconscious, who kept on existing even after Jake woke up. He even remarks that his existence is weird.
Although Green Lantern at first attempts to apologize to the freed citizens for destroying the utopia-illusion, this was shown to unambiguously be the right thing to do, unlike most examples. An ice cream truck driver brushes off GL's apology, revealing that the people were trapped in the illusion against their will, and freeing them finally gave them a chance to live their own lives and repair their world. "Being stuck in an ice cream truck for 40 years, that's a nightmare."
Another example from Justice League Unlimited (adapted from the Alan Moore classic "For the Man Who Has Everything"): Superman was caught by a Lotus-Eater Machine in plant form, called the Black Mercy, which had him dreaming he was on a still-existing Krypton with a wife and son, forcing him to consciously will the planet's destruction if he was to escape and save his superfriends. One of the last images from his dream is Krypton exploding as he clung tightly to his dream-son.
The Black Mercy gives you the strongest possible reason not to leave until it's done eating you. Mongul compares the sacrifice and/or effort of will required to "tearing off your own arm."
"Rarg", from an episode of Long Ago and Far Away, is a perfectly happy world where the sun doesn't come up until everyone's had a good night's sleep (don't think about it too much). Then scientists probing the nature of reality discover that their world is all a dream in the mind of someone asleep in the real world, and will probably vanish when he wakes up. To prevent this, they manage to open a portal to reality and bring the sleeper though.
In one episode of Cow and Chicken, an evil milkman from Cow's nightmare materializes in the real world and terrorizes Chicken, Flem, and Earl. When they wake Cow up, he disappears.
In the Transformers Generation One episode "Nightmare Planet", characters and settings from Daniel's dreams and nightmares come to life, including monsters that attack the Autobots, and a lovely fairy tale princess (who looks like Daniel's mom, Carly) who assists them. When Daniel wakes up at the end, everything from his dreams disappears. Springer, who had bonded with the princess, is distraught and asks what happened to her. Rodimus Prime sadly says that she never truly existed.
Played with in Captain Simian and the Space Monkeys. The crew and some villains find a crack in a wall where you can whisper anything you want and it will appear, but are warned by a guardian that it is really the ear of a sleeping giant who dreams the universe. Not believing this, they end up wishing for bigger and better weapons as they fight, only to actually wake the giant up, which causes the universe to start to disintegrate until they manage to make him sleep again with a Techno Babble 'lullaby'. However, in the end, appropriately enough, the whole episode is implied to be All Just a Dream.