Big Finish Doctor Who has a story called Doctor Who and the Pirates which turns into a piratical musical. In addition to using many tropes common to Musicals in general, including several lampshades about characters' tendencies to break into song. The story even gives the Doctor the song, "I Am The Very Model of a Gallifreyan Buccaneer".
Kate & Leopold: Leopold gets the plot wrong.note He describes the main character as the pirate king who falls in love, and claims that the pirate king has never seen a woman. The character he was describing was actually Frederic, the apprentice pirate and main character. Even so, that's remarkably good going considering Leopold is from 1876 and the first performance of The Pirates of Penzance was in 1879.
The West Wing episode "And It's Surely To Their Credit" has a Running Gag about the White House Counsel, Lionel Tribbey, mistakenly attributing "He Is An Englishman" to The Pirates of Penzance (it's actually from H.M.S. Pinafore). Nearly everyone in the cast points out his mistake and that all of Gilbert and Sullivan's work is about duty.
Aaron Sorkin also used a parody of The Major-General's Song in Studio 60 on the Sunset Strip. Unfortunately, it wasn't very impressive as there were no real jokes and it was also sung way too slowly.
Frasier, episode "Fathers and Sons": Frasier, Niles, and Leland are familiar with, among other Gilbert and Sullivan works, The Pirates of Penzance. Martin—not so much.
Leland (singing):...With many cheerful facts about the square of the hypotenuse! Frasier, Niles, and Leland (harmonizing): With many cheerful facts about the square of the hypotenuse, with many cheerful facts about the square of the hypotenuse, with many cheerful facts about the square of the hypote-potenuse! Martin (attempting to join in): With many awful facts about the scary hippopotamus!
Babylon 5: Marcus Cole attempts to cheer up Dr. Franklin by singing The Major-General's song, after the episode's adventures leaves the two of them stuck in the cargo hold of a long-haul freighter. The doctor is less than amused.
Thoroughly Modern Millie sets "The Speed Test" to music based on "My Eyes Are Fully Open"note which is originally from Ruddigore, but most modern listeners are more familiar with it from this show. The letter being dictated actually begins "My eyes are fully open to my awful situation", and the song gets progressively faster as in the Penzance and Ruddigore songs do.
From Hamilton, the song "Right Hand Man" has the lyric "Now I'm the model of a modern major-general..."
Runescape has a song titled "The Pirates of Penance"
He even changed some of the Major General's lyrics to fit his current career.
I am the very model of a scientist salarian, I've studied species turian, asari and batarian, I'm quite good at genetics (as a subset of biology), because I am an expert (which I know is a tautology). My xenoscience studies range from urban to agrarian, I am the very model of a scientist salarian.
Animaniacs: Though the play itself isn't directly referenced, a few of the music numbers from The Pirates of Penzance get some Weird Al-esque treatment from the Warner Brothers (and Warner Sister) in the pirate-themed Musical Episode "H.M.S. Yakko". For instance, the melody of "With Catlike Tread" gets used for "We Surf The Seas", and the melody of "I Am the Very Model of a Modern Major General" gets used for "I Am the Very Model of a Cartoon Individual".