In the end of the Get Smart episode "The Not So Great Escape", Control agents whistle the theme song as they leave the Kaos prison camp.
On The Fall Guy, Howie is reading the lyrics to a song he wrote (the show's theme song, "The Unknown Stuntman"). During the show, Colt and Howie make a bet where Colt says he'll sing the song live on stage if he loses. He does.
Classic example: In I Love Lucy, one episode has Lucy certain that Ricky has forgotten her birthday. She makes her way to the nightclub where he works, where he assures her he has not forgotten and sings the show's theme song to her, Forgotten Theme Tune Lyrics and all.
A classic example occurred in Green Acres. At the start of the episode, we see Eb going off to do his chores while whistling the theme song. He then turns and looks straight at the camera to say the line "Dahling, I love you, but give me Park Avenue" in Lisa's voice.
Drake & Josh: In the episode "First Crush", Drake Parker sings the show's theme song ("I Found a Way" by Simple Plan) until a snake appears on his shoulder and gets thrown into the audience.
Zoey 101: In "Back to PCA", "Follow Me" by JoJo, the show's theme, is heard during the final scene.
In an episode of Mad About You, Paul walks past an A Cappella group singing the theme song, which he'd cowritten. To further mess with the wall, he mentions its familiarity. At the end of the episode, Paul and Jamie listen to the same group singing the theme again as the end-credits play. This time, Paul recognizes the tune and grins with satisfaction, but does not identify the tune out loud.
My Two Dads had one episode where the theme song was performed by Evigan (the other Dad of the title) and... special guest Davey Jones of The Monkees.
An episode of Pretty Guardian Sailor Moon has the characters doing karaoke with, and later synchronizing their attacks to, a song by Minako Aino, who later turns out to be Sailor Venus (the song, incidentally, repeats the phrase "C'est la vie", which sounds pretty much like "Sailor V" in Japanese) and which song is available on the soundtrack albums. (All the soundtrack albums. Sometimes more than once.)
Tweenies: In one ep, some character has a blow-up guitar balloon and is singing, "Hey, hey, are you ready to play?"... the first line of the show's theme tune.
The opening scene of the first episode of The Young Ones has Rick rocking out to the show's theme song. Somewhat justified since the song predates the show, though the fact that he was explicitly listening to the cover version sung by the actors from the show creates a bit of a Celebrity Paradox.
"This Old Man", which in the later years of Columbo was sometimes used as unofficial theme music (the show never really had a theme as such) also appears in a lot of episodes in some form, usually being hummed or whistled by the title character.
With a twist. Battlestar Galactica (2005) uses the theme music not from that series, but from the original Battlestar Galactica, as what appears to be the Colonial anthem. In the pilot, an honor guard play it at Galactica's decommissioning ceremony. In the episode "Final Cut", it underscores the patriotic ending sequence of a Show Within a Show documentary. And one more time in the final episode when the fleet is auto-piloted into the heart of the sun.
"Chimera". Carter hums the SG-1 theme music in the elevator, prompting O'Neill to deduce that she has a new boyfriend. Word of God has it that the actress actually wanted to hum MacGyver's theme music as a nod, but she completely forgot the notes so she hummed the Stargate theme instead.
The episode "200", which is rife with self-reference, features the hypothetical wedding of Carter and O'Neill. The music in the background begins with Here Comes The Bride, but segues into the SG-1 theme.
In a related matter, the SG-1 theme also appears in the BGM of the Stargate Atlantis episode "Home" when the main characters arrive back on Earth.
SG-1 returns the favor by using the Atlantis theme in "The Pegasus Project," when SG-1 visit Atlantis.
The opening in the episode "Leclerc Against the Wall" featured the usual opening shot of Rene in his cafe as the instrumental theme song plays. It fades out as Rene begins playing the exact same song on the cafe piano.
In another episode an accordionist is heard wandering the town square outside the cafe, playing a slower version of the theme on his accordion.
Veronica Mars: At the close of The Teaser to one episode, Veronica wryly notes of an estranged acquaintance, "We used to be friends, a long time ago," the opening words (inverted) of the show's Theme Tune.
Similarly: On WKRP in Cincinnati, during one episode recounting events prior to the start of the series ("The Creation of Venus"), Andy explains that he'd come to Cincinnati because he'd "gotten kind of tired of packing and unpacking, town to town, up and down the dial" — the same explanation offered in the theme song. He lightly lampshades this by saying it as if he were alluding to well-known words.
In The Fresh Prince of Bel-Air, while giving his testimony at the bench during a court case, Will falls into the his lyrics when introducing himself.
The serial "Paradise Towers" had a Muzak version of the theme music playing in an elevator.
"Vale Decem" in The End of Time is being sung by the Ood as the song they promised him. Just as 10 is beginning to regenerate, they shift into a triumphant/heartwrenching version of "The Doctor's Theme."
A cello trio is playing Martha's theme in The Lazarus Experiment.
In the finale for season one of Smallville, the band that plays the show's theme song (Remy Zero) is playing at the Smallville High prom. And what do they play? Yup. You got it.
When Dr. Swann (former Superman actor Christopher Reeve, of course) tells Clark he's from a place called Krypton — this being the first time the name is mentioned, a few years into the series — we suddenly hear one of the fanfares from the Reeves movie series.
One episode of the Granada series The Adventures of Sherlock Holmes ends with Holmes beginning to play the series' theme tune on his violin.
In "Fascination" in the third season of Star Trek: Deep Space Nine, Odo conducts a bajoran band playing a hardly recognizable version of the theme song.
One Joan of Arcadia teaser has God singing (a humorously bad, given the character) version of Joan Osbourne's "One of Us," which was appropriated as the show's theme song. This segued directly into the credits.
In the Growing Pains episode "All The World's a Stage", Mike Seaver and his choir sing the opening theme song — and it serves as the theme song for that episode.
The original title theme of Monk by Jeff Beal, which was since replaced with It's a Jungle Out There (Randy Newman), has since often come up in the show as background music, usually in dramatic scenes or those having to do with memories. In one memorable instance, however, Randy Disher plays the song on a piano. When Stottlemeyer asks him what he's doing, Disher says "background music".
In one episode of Hogan's Heroes, the Heroes pretend to escape so an Italian spy can "capture" them. When he marches them back into camp, they're all whistling the show's theme song.
In period drama Upstairs Downstairs, Sarah performs the stately waltz of the opening tune as a Bawdy Song ("What Are We Going to Do with Uncle Arthur?") in her music hall act.
All music on Good Eats is the theme, at different tempi and in different styles.
An episode of The Nanny ended with Fran describing how she got to her current station in life by reciting the lyrics of the opening theme.
Another episode where a Fran notice similarities between her and a fellow nanny that was going to be fired since the kids had grown up, the other nanny begins to describe that the way she got the job with the opening theme as well.
Yet another example was when Fran was describing her fashion sense with "I've got style, I've got flare, that's how I became (Beat) the nanny"
The lost culture in the Farscape two-parter "What Was Lost" chanted the series theme as they sacrificed goats. This may have been foreshadowing the larger role, plotwise and thematically, that they would play in the miniseries.
In the episode "Losing Time", John can also be heard humming along to the background music while walking through Moya's corridors.
In the Red Dwarf Western-VR episode "Gunmen of the Apocalypse", the piano in the Last Chance Saloon is playing the theme as the main characters enter.
In Back to Earth, a haunting rendition of the theme tune is played by the Creator's doorbell.
A scene in Scrubs starts with JD and Turk walking in, singing the theme tune (Superman by Lazlo Bane).
While not being sung, in a later episode Doctor Kelso is seen talking with some beach babes, saying to them "... I can't do this all my own!"
"Guy Love", which only really existed as part of an aneurysm induced hallucination, nevertheless shows up as Turk's ringtone in a later episode.
JD and Turk also beatbox the themesong when they're gloating about diagnosing one of Dr. Cox's problem patients.
And when Elliot puts one of those electronic "piano carpets" at her door, JD walks in and starts dancing around on it. Guess what he plays.
JD: Hmm. Catchy!
The drumbeat at the start of the theme tune, always played onscreen before it actually goes into the titles, is played by a character on a couple of occasions. In My Office JD plays it out by bursting bubblewrap and in My Best Friend's Baby's Baby and My Baby's Baby it's done by a drummer in a marching band.
On Dallas several members of the Ewing family (Bobby, Pam and Lucy) as well as Ray Krebbs went to a disco, where the DJ started playing the Dallas theme tune.
Xena: Warrior Princess: Xena played the theme song in one episode (on a lyre that sounded surprisingly like an electric guitar). Another time, she whistles it while fishing.
Big Wolf on Campus has Merton trying to compose a song on a piano, that is actually the show's theme tune. It's a double reference as the actor who plays Merton created the theme tune in real life. Unlike a lot of other examples of this trope, the song Merton writes actually has vital plot relevance later in the episode.
In The L Word, every single tune you hear is some kind of adaptation of the theme music. It's exactly as annoying as you'd think.
WindWave Radio in Kamen Rider Double when left on tends to play various bits of music including the eponymous hero's battle themes, all of which were written by fictitious bands from the show.
Episodes 21 and 22 has a whistling tune of "Cyclone Effect" — one of said battle themes - play a part of the case. Philip and Shoutarou sings "Finger on the Trigger" in episode 23 in Fuuuuuutic Idol, their equivalent of American Idol.
Another toku example: In one episode of Warrior Of Love Rainbowman, hero Takeshi Yamato sings the ED theme, which is his theme song.
In the very early episodes of The Beverly Hillbillies, the balladeer not only sings the theme song, but sings new lyrics to reflect the on-screen action, in part a feud between the Clampetts and the Drysdales.
In "Jed Throws A Wingding", two old friends of the Clampett family write a song about Jed, which turns out to be the theme song.
The two friends are musicians Lester Flatts and Earl Scruggs who provided the music for the theme song.
Kate's ringtone is a version of the themesong in a season 2 episode of NCIS.
Played with on The Big Bang Theory: Howard's cellphone ringtone is the song that was used as the theme tune... in the unaired pilot.
In an instance which was bound to happen eventually based off the show's format, Don't Forget The Lyrics offered its own theme song (the Doobie Brothers' "China Grove") alongside the theme of Green Acres in a "TV Themes" category. Unfortunately, the clueless contestant, despite claiming she had never watched it, went with Green Acres, and promptly lost.
In The Middleman, the Muzak playing in the lobby of the Jolly Fats Wehawkin Employment Agency (the front for the Middle organization) was based on the show's theme.
In Castle, the title character occasionally hums the show's standard "exciting things are happening now" background music to himself.
In "Last Call", as he enters an old drinking establishment he used to frequent, the piano man starts playing that same riff. Castle tips him for remembering.
In one episode of Made In Canada, one of the characters sings the theme song during a party; in another, the song is heard playing on a CD player.
The New Girl pilot has Jess singing the theme song at one point.
In the second The Wild Wild West TV movie, More Wild Wild West, Artemus Gordon hums the main theme from the show while getting ready in front of a mirror.
In the Psych episode "The Amazing Psych Man & Tap-Man, Issue #2", Shawn tells Juliet "I know you know I'm not telling the truth. I know...you know...".
The Office (UK) episode "Training" ends with David Brent singing and playing the theme song, "Handrags and Gladrags", on guitar. (Kind of justified in-universe, in that it's a song that predates the series, and presumably was part of the repertoire of Brent's old band Foregone Conclusion, which is discussed in the episode.)
The Tribe: Sasha plays the theme from The Tribe on his flute in his first episode as an official Mall Rat. A few episodes earlier, the piece of music Tai San uses during her dance routine is the same incidental music used during establishing shots.
In Teen Wolf, season 2 episode 12, "Master Plan", the opening credits/theme song is heard during the fight scene involving Derek, Scott, Isaac, Jackson, and Allison.
Game of Thrones has a lot of fun playing with the fact that the song "The Rains of Castamere" is both the in-universe favorite song of the Lannister family and a frequent soundtrack motif and sometimes end credit theme for the show. It was easter egged as a tune that Tyrion was whistling and as background music in several scenes before viewers ever heard the lyrics or found out why the song was important.
In the Pretty Little Liars episode "Over My Dead Body," Emily has a carbon-monoxide-induced hallucination that she's talking to Alison; when she asks who "A" is, Alison's reply quotes the opening song "Secrets" - "Two can keep a secret if one of them is dead."
Mr. Lucky's watch plays the first five notes of the show's theme tune - his theme - when opened.
An episode of Absolutely Fabulous had Edina and Patsy singing a (drunk, naturally) karaoke version of the theme song, possibly during the closing credits.
In the season 1 finalé of Buffy the Vampire Slayer, the theme tune plays briefly as a newly-revived Buffy marches into the school to face the season's Big Bad.
In the series finalé of Dawson's Creek, Jen is shown a video that Dawson supposedly made back in season 1; it's a slight re-working of the show's original credits, including the original theme tune. ("One Hand In My Pocket" by Alanis Morissette)
In Cranford, the music for the waltz at the end of Return to Cranford is the Instrumental Theme Tune of the series, albeit in 3/4 time (the original was in 4/4). It's called "Cranford Waltz".
During one MythBusters episode, Adam and Jamie were using underwater speakers to test whether sharks were attracted to sounds of a certain pitch. To test the speakers, Adam played the show's theme tune while Jamie, underwater in a shark cage, listened... then started dancing to it.