Patricia Heaton has become the queen of comedy on television for over two decades, having won multiple Emmys for her nine-season role as Debra Barone on “Everybody Loves Raymond” and then hitting paydirt with another nine-season hit, “The Middle.” In both, she played wives and mothers whom America could relate to, while being a reliable source of clean family entertainment, no doubt due to her outspoken Christian conservative beliefs.

Heaton is back with yet another winner in the new CBS sitcom “Carol’s Second Act” but this time she wisely mixes things up a bit. Rather than focusing on domestic life as a wife and mom, Heaton’s new character Carol Kinney is a woman in her mid-50s who has decided, with an unseen husband who left her to “find himself” and a grown daughter, to retire from teaching and pursue her real dream of becoming a doctor.

The pilot episode finds Carol as an intern at the fictional Loyola Memorial Hospital in Los Angeles, where she’s alternately too giddy in her excitement about being a doctor and yet also proves to be a calming, wise presence due to the extra decades of life experience she has over her fellow interns. Those interns – a woman named Lexi (Sabrina Jalees) who is the first in her family to go to college, much less med school; an initially over-confident, yet surprisingly sensitive, guy named Daniel (Jean-Luc Bilodeau); and an overly PC guy named Caleb (Lucas Neff), who fills the goofy doofus role in the series – are initially rivals.

But within the sharply written pilot by  the longtime writing team of Emily Halpern and Sarah Haskins, who co-wrote the incredibly crass feature-film comedy “Booksmart” earlier this year, but keep it refreshingly clean yet smart, the relationships quickly gel in a positive fashion. The funny foursome of interns play well against their two supervsors: the tough as nails, no nonsense chief intern Dr. Maya Jacobs (Ito Aghayere), and the goofy senior doctor of the intern program, Dr. Frost (Kyle McLachlan, in a surprisingly strong change of pace from a career in mostly serious and even nefarious roles).

The main plot aside from introducing the characters involves a male patient who has been suffering from migraines and thinks they’re from a car accident. But Carol notices some unusual details of his condition and winds up providing a surprising diagnosis that lends the show some touching moments, played in a way that is rare in studio-audience sitcoms.

There’s some fun physical comedy mixed in, with a great slapstick moment that reveals a side we haven’t seen from Heaton before. The pilot feels slightly claustrophobic by being set in just three or four rooms of a hospital, but hopefully future episodes will mix in other aspects of Carol’s newly single life with equally comic aplomb.

The show positively reminds viewers that the medical profession is a noble one, with people who want to help others and save lives. The only downside in the whole episode morally is a brief pair of jokes that appear to reveal that Lexi is lesbian, but they fly by so fast and switch quickly to other types of jokes that it’s likely such references will only be in passing if used at all.

The show’s  ability to be deeper than usual emotionally stems both from the ace writing duo (they have prior credits on multiple acclaimed series) and director Pamela Fryman, one of the most talented veterans in TV comedy. Put it all together, and “Carol’s Second Act” should be a successful third act for Heaton that could also play for years to come by providing family-friendly comedy that’s smart enough for adults as well.

“Carol’s Second Act” premieres Thursday, Sept. 26 at 9:30 p.m. PST/EST and 8:30 p.m. CST.