The CBS comedy closes out its 12-season run with its biggest audience in more than three years.

The Big Bang Theory went out with, well, a bang.

The series finale of CBS' longest-running sitcom ever delivered the show's biggest audience in more than three years and its best 18-49 rating since midway through the 2017-18 season.

The hourlong finale drew just under 18 million viewers, the most for the show since the season nine premiere in September 2015. It's also the biggest audience for an episode of a regular series this season (excluding the post-Super Bowl premiere of The World's Best). Big Bang's 3.1 rating in adults 18-49 was the best for any scripted broadcast show this season and the show's highest since January 2018.

In the final ratings, the finale adjusted up to 18.52 million viewers and a 3.2 demo rating.

Following the Big Bang finale, the season finale of spinoff Young Sheldon hit season highs of 13.7 million viewers — its best since January 2018 — and 2.2 in adults 18-49, tying with last season's final episode. A Big Bang Theory retrospective posted a 1.8 and 11.76 million viewers at 9:30, and the season finale of SWAT (5.99 million viewers, 0.9 in 18-49) tied its season highs.

The Big Bang cast's appearance on The Late Show With Stephen Colbert also boosted its ratings to a 3.8 in metered-market households and 0.7 in adults 18-49, the show's best in months.

Outside CBS, the season finale of Grey's Anatomy on ABC fared the best with a 1.3 in adults 18-49, even with last week's early numbers (it adjusted up in the finals). Station 19 finished its season with a 0.8, off slightly week to week, and For the People's last episode ticked up to 0.5.

The Big Bang celebration sapped some viewers from NBC's comedies, as the hourlong Superstore finale drew a series-low 0.6. Brooklyn Nine-Nine tied its season low at 0.5 with its hourlong closer, and Law & Order: SVU finished its season with a 0.7, even with last week.

Paradise Hotel posted a 0.3 for Fox, even with Wednesday's show but down 0.2 from its premiere a week ago. The CW's iZombie and In the Dark both came in at 0.2 on The CW.

CBS easily led the night with a 2.0 rating in adults 18-49. ABC was the best of the rest at 0.9, followed by NBC at 0.6. Telemundo and Univision tied at 0.4, Fox averaged 0.3 and The CW 0.2.