"The Big Bang Theory" finished off its long and successful run as television's top-rated comedy with a low-key but emotional farewell to the intrepid gang of nerdy misfits.

[SPOILER ALERT: The remainder of this episode will discuss the final episode of "The Big Bang Theory."]

The long-running series on CBS concluded with two back-to-back episodes, "The Change Constant" and "The Stockholm Syndrome," in an hourlong finale Thursday evening. The series exited the airwaves with the most episodes for a multicamera series ever with 279 episodes. It edged past NBC's "Cheers," which aired for 12 seasons and 275 episodes.

Thursday's finale was followed by a behind-the-scenes look at the show in "Unraveling the Mystery: A Big Bang Farewell" with Johnny Galecki, who played Leonard, and Kaley Cuoco, who played Penny, as hosts.

'THE BIG BANG THEORY' STARS REFLECT ON SERIES ENDING

During the finale, the show's friends took one last trip together to support married couple Sheldon (Jim Parsons) and Amy (Mayim Bialik) after they won the Nobel Prize in physics. The couple waited anxiously by the phone while friends prank called them before receiving the actual decision.

The final episodes were filled with a few surprises including news of Penny's pregnancy, a surprise cameo from Sarah Michelle Gellar and the elevator finally being fixed after it had been broken for much of the series.

It included a scene in which Bialik, who is a neuroscientist in real life, urges young girls to pursue careers in science during her Nobel acceptance speech. "Little girls who dream about science" should ignore naysayers, she said.

In a fitting end, the often self-absorbed Sheldon followed his wife with his own heartfelt speech about the importance of friendship where he finally thanked the gang for putting up with his various eccentricities over the years.

‘BIG BANG THEORY’ STAR JOHNNY GALECKI SHARES EMOTIONAL VIDEO OF THE SHOW’S SET BEING PACKED UP

"The Big Bang Theory" debuted in 2007 and overcame early doubts to become a cult classic after some questioned the show's chances of survival. With its live audience and use of multiple cameras, the series is a throwback to comedies from the early days of television, but its formula proved popular.

The show was led by a crew of nerdy misfits starring Parsons, Cuoco, Galecki, Bialik, Simon Helberg, Kunal Nayyar and Melissa Rauch.

It won 10 Emmy Awards, including four for Parsons.

The comedy leaves on a high as one of television's most popular shows. Last week's episode was the most-watched program on broadcast or cable TV with 12.5 million viewers, beating out HBO's "Game of Thrones," which ends its series on Sunday after an eight-year run.

CLICK HERE TO GET THE FOX NEWS APP

Parsons has said the end of the series feels like a "real rite of passage moment," which was full of memories and some tears. Galecki said the show has touched "so many hearts."

The Associated Press contributed to this report.