Television has always been a medium that broke the walls of reality. From its earliest days, television shows "came into your living room." So it's not surprising that television has always dabbled in metafiction, fourth-wall-breaking and transrealism. Here are the six types of "meta" storytelling on television.
First, let's define our terms. We're defining "metafiction" as any story that comments on itself or on the act of telling a story. And "transrealism," as invented by Rudy Rucker, is anything that uses actual people and events in a fantastical way and crosses over from the real to the unreal. (I may be using it slightly more broadly than Rucker.)
Basically, anything that crosses the streams between reality and fiction, or comments on the fiction itself. Because there's something inherently science fictional about breaking out of the box.
With that out of the way, here's a brief and totally incomplete history of "meta" on television:
Lands of Fiction and Storytelling
Children's television in the 1960s was full of weird crossovers between the real world and a fantasy/fabulist world. Just the sight of adult humans standing next to puppets or people in fluffy costumes and talking naturalistically is sort of a bizarre sight. But a few things stick out in particular.
Doctor Who visited the Land of Fiction in "The Mind Robber," in which the biggest danger is that the Doctor and his companions would become fictional characters. (And the Doctor also broke the fourth wall and addressed the viewers at home a few years earlier, in "The Feast of Steven.")
Around the same time, in the United States and Canada, Fred Rogers was crossing over from his living room (where he famously hangs out and puts on his sneakers and sweater, etc.) to the Land of Make-Believe, where full-sized adults interact with the fantasy puppets of King Friday and his subjects. I have a feeling the "portal fantasy" of Mr. Rogers Neighborhood had a huge, bizarre impact on a couple generations of creative people:
Then there's also Sesame Street and The Muppet Show — both of which included real-life celebrities interacting with Kermit, Miss Piggy, and various other fantasy characters, as though these talking animals were just regular celebrities:
Fake interviews and meta-reality TV
There have been fake interviews, wacky on-camera hijinks and news spoofs since the days of Candid Camera, Saturday Night Live and Not the Nine O'Clock News, among others. But in the late 1990s, fake interview shows got a lot more bizarre and fantastical.
Most notably, in the U.K., there was Brass Eye, a show in which Chris Morris would convince celebrities to condemn a fictional drug called Cake and warn about the dangers of "heavy electricity," a form of electricity that could flatten cattle:
Following the success of Brass Eye, Sacha Baron Cohen made a huge splash with Da Ali G Show, in which he plays a few different fictional characters who do inappropriate, weird interviews with important politicians and celebrities:
And meanwhile, Space Ghost Coast to Coast features similar fictional interviews, except that they're conducted by a cartoon superhero from the 1960s. (Thanks for the reminder, ThePinkPeril!)
There's also Kathy Griffin's My Life on the D List, which satirizes and amplifies celebrity culture. And The Comeback, in which Lisa Kudrow as a failed sitcom actress starring in a comedy and reality show.
In a similar vein, the Larry Sanders Show features the fictional Larry Sanders interviewing real-life celebrities, who often play weirdly over-the-top versions of themselves. (And his previous show, It's Garry Shandling's Show, played with the sitcom conventions and broke the fourth wall regularly. Thanks, HollywoodCed!)
Which leads us to...
People Playing Themselves:
Or versions of themselves. The movie This is the End made a huge impact this summer with James Franco and other celebrities playing fucked-up versions of themselves. But there have been a billion TV shows in the past couple decades that have done versions of this. Including Seinfeld, and the show Curb Your Enthusiasm from Seinfeld's creator Larry David:
And edgy showbiz comedies like Extras and Entourage feature tons of cameos and appearances by famous actors.
Also, Dirty Dancing's Jennifer Grey played a parody of herself in the sitcom It's Like, You Know. James Van Der Beek did basically the same thing in the sitcom Don't Trust The B— in Apartment 23. Matt Le Blanc from Friends played himself in a show called Episodes. Wil Wheaton and other actors have played themselves on The Big Bang Theory. Luis Guzman had a recurring appearance as himself on Community. Also, a ton of actors and celebrities have voiced versions of themselves on The Simpsons and other animated comedies. And Duckman was famous for having tons of celebrities put in appearances, along with a habit of commenting on the real world.
TV show within the actual show
This is a common trope in science fiction and fantasy — suddenly we pull back and see the fakeness of the TV show. Or the characters on the show visit the "set" of the TV show they didn't know they were on.
Supernatural has dabbled in meta a lot, including having a series of Supernatural books within the TV show that chronicle Sam and Dean's adventures, spawning a whole fan culture around the hunters. But also, in the episode "The French Mistake," Sam and Dean cross over to a version of "our" world, where they're actors and this is a TV show:
Something similar happens on The Fresh Prince of Bel-Air. And in Eerie, Indiana, one of the characters receives a TV script for the show in the mail and then finds himself on the set where everybody thinks he's an actor. (Thanks, neon_suntan!)
In a similar vein, the 1990s Spider-Man cartoon features Spidey coming to "our" world and finding out he's a comics/cartoon character, and haning out with the actor who plays him on TV, plus his creator, Stan Lee:
The X-Files and Stargate: SG-1 also featured fictional TV show versions of the actual shows, with Garry Shandling playing Mulder and Tea Leoni playing Scully. Also, Married With Children has a fictional sitcom about the life of the Bundy family.
And then there's this:
And meanwhile, the 1990s Star Treks flirted with metafiction on a number of occasions, mostly thanks to the device of the Holodeck. On Deep Space Nine, Sisko has a vision that he's a 1950s science fiction author, writing stories about a black captain in the far future. (Thanks, ssimonss!) On Voyager, both Seska and the holographic Doctor write holographic novels about the ship and its crew. And then the final ever episode of Star Trek, the finale of Enterprise, basically turns the entire four-year series into a holodeck entertainment that Riker has been amusing himself with in between scenes of Star Trek: The Next Generation:
Talking to the Audience
Probably the most influential early versions of the classic "breaking the fourth wall" thing, where someone turns and talks to the audience directly, come from the Jack Benny Show, and also from George Burns and Gracie Allen. Burns not only talks to the audience, we also see him watching his own TV show. (Thanks to Greg Cox, and everyone else who pointed this out!)
The Drew Carey Show features an episode where Drew talks to the audience about the fact that the show hasn't gotten any Emmy nominations, and then the whole rest of the episode is a "serious," "important" episode, full of people commenting on why they deserve an Emmy.
Lots of shows have narrators/main characters who address the audience directly, and some shows push this way further — like, Malcolm in the Middle will feature Malcolm stopping in the middle of a scene to address the audience directly. Ditto for Francis Urquhart in the show House of Cards, and a number of other shows. Also, as various people have pointed out in the discussion below, Moonlighting featured endless amounts of fourth-wall-breaking.
The show Parker Lewis Can't Lose features a ton of "breaking the fourth wall" moments from Lewis, who serves as narrator and curator of all the surrealism in the show. Also, Northern Exposure features actors commenting on the TV show and addressing the audience. (Thanks for the heads up, Gibbelins!)
On My Little Pony: Friendship is Magic, Pinkie Pie can frequently break the fourth wall:
The Simpsons has also broken the fourth wall and the walls of reality in many different ways, over the years, including one story where Homer crosses over to "our" reality:
And the classic Looney Tunes cartoons not only broke the fourth wall regularly, but also played around with the limits of the cartoon universe in various ways, with Bugs Bunny often seeming to be able to exploit cartoon physics because of some level of awareness of his existence as a cartoon character.
In Mystery Science Theater 3000, a guy and two robots are stuck on a space station, forced to watch bad movies, and they become kind of an extra layer of audience between us and the film being watched. The show's theme song actually encourages you not to worry about the "science facts" of how Joel gets food and oxygen, because "it's just a show":
I Love Lucy features Lucille Ball and Desi Arnaz sort of playing themselves — and it's a TV show about trying to get on a TV show. (Thanks, enceldus28!)
The final moments of Newhart, Bob Newhart's 1980s show, feature him waking up in bed next to Suzanne Pleshette on the set of his 1970s show, and saying he just had the strangest dream. (Thanks Dragon!)
The classic late-1970s show SOAP satirizes soap operas, and pushes the satire beyond self-consciousness into a kind of bizarre self-parody, including an over-the-top narrator.
Xena: Warrior Princess carried on an overt dialogue with its fans, including tons of shout-outs and easter eggs, and a focus on the Xena-Gabrielle relationship designed to appeal to the most vocal shippers.
On Boston Legal, William Shatner makes lots of Star Trek in-jokes, and also makes a Twilight Zone joke when he appears on Third Rock from the Sun.
Arrested Development is full of super-meta moments that break the walls of reality, and here's a list of 20 of them. Including Henry Winkler jumping over a shark:
A big part of Bryan Fuller's "magical realist" style, in shows like Wonderfalls and Pushing Daisies, seems to involve a certain amount of fourth-wall-breaking and metafiction. His new show Hannibal plays with audience expectations in a self-conscoius way and also finds ways to comment on itself as a narrative.
Also, Raising Hope features a lot of weird unofficial crossovers with creator Greg Garcia's other show My Name is Earl, including a poster for a My Name is Earl movie. (Thanks to RedCrown for mentioning this one!)
And finally, this year brought us Rockne S. O'Bannon's Cult, possibly the most meta TV show ever made. A cult TV show about a cult TV show about a cult, in which the hope was apparently that the "real" TV show and the "fake" TV show would cross over in such mind-blowing ways that the result would actually start crossing over into our reality — which, sadly, did not happen.
So what did we leave out?
Thanks to Genevieve Valentine, Annalee Newitz, and everyone else who suggested stuff!