BURBANK, Calif. — "The Big Bang Theory" extended its sitcom longevity record when it filmed its 279th and final episode Tuesday. It may have set another record for hugs, too.

Hugs, smiles, laughs and tears were in abundance as cast and crew of the top-rated CBS comedy filmed the second half of its one-hour series finale (May 16, 8 EDT/PDT).

VIPs and members of the media were present, but the soundstage bleachers were filled primarily with devoted fans, some waiting overnight to get seats and others wearing self-designed T-shirts celebrating the show's 12-season run.

They laughed, gasped and awwwwed their way through the episode — details are under wraps, so we can't spoil — but saved their loudest cheers for the emotional bows and messages from the stars.

More:'The Big Bang Theory': Behind-the-scenes secrets about that Shamy kiss and Howard's mom

More:'Big Bang Theory' finale: Stars pick their favorite guests, episodes and props

Emotions were on display during cast introductions, as Jim Parsons' eyes glistened and Mayim Bialik, Simon Helberg and Kunal Nayyar could be seen wiping tears as they took their bows.

Kaley Cuoco and Johnny Galecki smiled and embraced, leading to a hug-a-thon on the familiar living room set, with co-creators Chuck Lorre and Bill Prady, director Mark Cendrowski, producers, writers and crew members joining the actors. Some women, including costume designer Mary Quigley, wore tiaras.

As scenes were prepped and shot on Stage 25, renamed The Big Bang Theory Stage in February, a nearby reception on the Warner Bros. lot featured show-friendly touches: drinks named Bazinga! and Soft Kitty, lab beakers filled with M&Ms and fortune cookies that offered fitting advice: "When the elevator is broken, take the stairs."

More:'Prepare yourselves': 'Big Bang Theory' cast shares emotional photos from last table read

The importance of the studio audience, a common element in Lorre's sitcoms, was apparent when Nayyar and Galecki, both celebrating their birthdays Tuesday, and Cuoco thanked fans during scene breaks.

Galecki, his voice breaking at times, praised "the most amazing team of writers" and thanked the 200-plus people in the studio bleachers on behalf of the actors and the many others who make the comedy series.

"You've been the best fans for 12 years. You're part of our family," he said, before handing the microphone to a teary Cuoco, who has starred on the show with him for all 12 seasons.

"This is unbelievable. … It's been an honor and joy for this cast to perform for you guys for 12 years. Thank you so much for supporting us and for being there from the beginning," she said. "On behalf of this cast and crew, we love you so much and 'Big Bang Theory' will live on in our hearts for the rest of our lives."

More:Kaley Cuoco on the end of 'The Big Bang Theory': 'I am already, like, losing it'

During breaks, fans talked about their devotion to the show with Mark Sweet, who has warmed up the audience on many Lorre sitcoms.

One young Chinese woman, now studying in Montreal, said she and others gained academic inspiration from the "Big Bang" characters, much like Parsons' Sheldon did as a youth from Professor Proton.

Malerie Shakter of Oakland, California, told Sweet she stood in line 14 hours for the chance to see the finale. As a woman working in the tech industry, she said she found "the extremely powerful group of women (on the show) inspiring."

After one scene on the living-room set, the cast gathered for a circular huddle. And, as the last scene was about to be filmed, the actors got a big charge when Lorre handled the "clapper" that marks the scene and take number.

More:'The Big Bang Theory' cast shed tears when they learned the new season would be the last

More:'The Big Bang Theory' will end with Season 12 in May 2019: 'A true labor of love'

A few minutes later, Sweet started introducing cast members for their final bows. He called Brian Posehn, a frequent guest star, then Kevin Sussman, a regular in recent seasons as Stuart. Then, Melissa Rauch (Bernadette) walked out with Sussman followed by the other six main cast members, all holding hands.

Producers, writers and others, including recurring guest star Wil Wheaton, joined the festivities on set and — hardly a spoiler alert — more laughing, crying and hugging ensued. Lorre embraced a happy Parsons, then moved on to each cast member as if it were a reception line. Galecki shared long, emotional hugs with his colleagues. After trying to keep their emotions under control for so long, it was finally time to just let go.