When The Simpsons surpassed Gunsmoke as the longest running scripted television series, it naturally acknowledge it.
With "Treehouse of Horror XXVII", the show becomes the second longest running scripted primetime series after Gunsmoke (with 635 episodes). This is acknowledged by one of the joke credits, which reads "You're next, Gunsmoke".
At the end of "Lisa Gets the Blues", the family discusses how with the following episode they pass Gunsmoke as the longest running TV show. When Bart asks about the radio episodes, Homer stuffs a beignet in his mouth.
"Forgive and Regret" is the episode that surpasses Gunsmoke's record. This is commemorated with a special opening sequence featuring a showdown between Marshall Dillon and Maggie.