Mandy Moore is crying.

Given that she’s filming a scene for NBC’s breakout hit “This Is Us,” tears might as well be written into her contract. But the actress is trying to get through a particularly impassioned speech to Sterling K. Brown, who plays her adopted son, Randall, and it’s taking its toll. Take after take on the tree-lined streets of L.A.’s Hancock Park, which stands in for New Jersey, she pushes herself, the tears threatening to destroy the prosthetics that turn the 32-year-old star into a sixtysomething grandmother — until a passing bird “releases,” as Brown puts it ever so politely, on her hat.

The crew erupts in laughter, dissipating the tension that’s been building all afternoon.

Bryce Duffy for Variety

It’s that cry-until-you-laugh alchemy that has made the series the success story of the fall. The drama — which charts the lives of Rebecca and Jack Pearson (Moore and Milo Ventimiglia) and their adult children, Randall, Kate (Chrissy Metz), and Kevin (Justin Hartley), over several decades — is averaging 15 million viewers every week in L+7 ratings, making it one of TV’s top shows. A recent episode even edged out CBS’ “The Big Bang Theory” for the first time in the key 18-49 demographic.

It has been two years since broadcast has had a triumph like this: Fox’s “Empire” broke ratings records week after week in its freshman season but has declined since. “This Is Us” is, to put it bluntly, a game-changer. As ratings for season one climbed and social media exploded (in tears), it was a “no-brainer” to pick up the show for an unprecedented two more seasons, according to NBC entertainment chair Bob Greenblatt.

“We thought, ‘People love the show. Let’s just give them more of what they want,’” he says. The announcement was a strategic move to assure fickle viewers that the show wouldn’t be going anywhere.

As “This Is Us” prepares to wrap up its 18-episode season with a highly anticipated finale on March 14, the industry is still trying to analyze the formula that drove its success.

According to creator-showrunner Dan Fogelman, it’s all about the cast. “We don’t say, ‘Oh, we directed it so well,’ or, ‘Oh, what a well-written episode of television,’” he says. “The one thing we always say is, ‘Wow, we cast the hell out of this show.’”

But if you ask the actors, they’ll credit the writing. “I’ve been doing this for a while, and I’ve seen things that have been really good, but these guys just crack you open week in and week out,” says Brown. “I consider myself blessed.”

Then again, maybe it’s the plot twist baked into each episode, a hallmark of Fogelman’s scripts (witness 2011’s “Crazy, Stupid, Love”). Or maybe, jokes Fogelman, it’s Ventimiglia’s butt — which had a brief but memorable cameo in the trailer, racking up millions of viewers across social platforms before the show even premiered.

Or maybe it’s simply a sign of the times: Given ever-more-stressful headlines, viewers are flocking to a relatively uncomplicated show that offers an hour of escape.

“There’s a lot of pent-up emotion in this country, and people are finding it difficult to express it in appropriate ways,” says Fox Television Group CEO Dana Walden, whose studio produces the series. “And this is a show that you can watch and cry and feel a great degree of emotion. It’s cathartic, on top of being really extraordinary television.”

Adds Fogelman, “Ultimately, it caught everyone by surprise — myself primarily.”

“I’ve maybe had one other instance in 15, 16 years of doing this where the affection and love you have for a project is matched by the affection and love the audience has for it. That’s so rare and special.”

Mandy Moore

Bryce Duffy for Variety

While he has celebrated several big-screen hits, especially on the animated front (“Cars,” “Tangled”), Fogelman’s TV efforts (“The Neighbors,” “Galavant,” and last season’s “Grandfathered”) haven’t soared as high.

With its future assured, “This Is Us” now faces the challenge of standing out in an ever-more-competitive Emmy season. It has already racked up awards buzz — multiple Golden Globes nominations, a People’s Choice Award for best new series, a key win for episodic drama at the Writers Guild Awards — but broadcast has long been absent from the Emmy drama race: The last network series to earn a nomination was “The Good Wife” in 2011; the last one to win was “24” in 2006. And the competition has only gotten fiercer with the advent of streaming: Early favorites this season include Netflix’s “The Crown” and “Stranger Things,” along with HBO’s “Westworld.”

“We’re trying to do something that’s really ambitious, and we’re trying to do it on a network schedule,” says Fogelman. “We’re making 18 episodes right on top of each other, script after script, edit after edit. We have to have five act breaks and six acts and do it in 42 minutes. It’s a tricky set of rules to navigate — and yet have people talk about it in the same breath that they talk about other shows that don’t have to play by those rules.”

Fogelman is aware that some dub the show “schmaltzy.” As he spends his hiatus making a film (the multi-generational love story “Life Itself” from FilmNation Entertainment) and charting out the show’s second season, he’s forcing himself to tune those critics out and to retain the confidence that guided the first season.

“Our biggest challenge will be not doing anything different,” he says. “We’re not going try to be too cool, to be too ‘cabley,’ or make people cry; or focus on storylines that we know people like; or focus on storylines that people might hate. We have to keep on the same blinders with which we attacked this season.”

And he’s got a message for his critics: “I think we’re just going to hunker down with our writers and our eight actors and just live in our bubble and tell our stories and hope that people like them. And f— them if they don’t.”

***

“This Is Us” was born out of an abandoned spec script for a feature film lying at the bottom of Fogelman’s desk. When Walden recruited him to 20th Century Fox TV in 2015 from ABC with a four-year, eight-figure overall deal, she promised him Fox could offer him independence and would place shows where they’d have the greatest chance of success. No sooner had he signed the deal then he sent over the script, then titled “36,” about a group of people who shared a birthday. Rather than keep it for her own network, Walden “put on her studio hat” and sent the project to her friend and former colleague Jennifer Salke, president of entertainment at NBC.

“To have the freedom to know that your voice is being heard, even when they’re already crafting things in such immaculate and particular ways, I just feel blessed to be able to be a part of the collaboration. Because not on every set do you always feel heard. This one is not that case.”

Sterling K. Brown

Bryce Duffy for Variety

“It definitely felt more in keeping with shows like ‘Parenthood’ and ‘Friday Night Lights,’” Walden says. “It was a more purely character-based drama versus any sort of high-concept.”

Besides, her own network, Fox Broadcasting, was already working on another Fogelman project, “Pitch,” about the first female pitcher in the major leagues, which aligned corporately with a deal with Major League Baseball. “What we felt committed to with Dan was not locking up all of his shows at FBC,” she says.

The two series would take divergent paths: “Pitch” failed to connect with audiences, and no decision has been made on its renewal.

“I’m very proud of ‘Pitch,’” says Fogelman. “I stand as proudly behind it as I do this show creatively. Sometimes things are to blame that have nothing to do with the show: the time; where it launches; what night it’s on television. It’s out of your control. There’s no accounting for any of it. It’s been a strange thing to watch.”

The minute “This Is Us” landed on Salke’s desk, she called Fogelman in for a meeting. She loved it so much, she says, “I remember feeling like I wish I could erase my memory and just read the script again.” The drama landed a key time slot after “The Voice” and a massive marketing push.

“Everybody in this company who had eyes on this script in the development process felt it from the very beginning — which is never a guarantee of anything

succeeding. I can tell you a number of shows where I felt that,” acknowledges Greenblatt. “But it’s really nice to have the audience respond.”

For Salke, the success of “This Is Us” has been a career-defining moment. As the executive VP of creative affairs at 20th Century Fox TV, she’d been part of the team that developed “Glee” and “Modern Family.”

“Coming here, I put a high expectation on myself that I needed to be able to deliver something like that,” she says. “I would have been personally disappointed if I went through my career here and didn’t experience this kind of feeling again, because it’s what excites you about this business.”

“It’s not just about race or weight. It’s about a relationship or marriage or siblings. There are kids who watch who relate to the storylines about our younger selves. Everybody, every age, every race, every religion, every creed, everyone is relating to it.”

Chrissy Metz

Bryce Duffy for Variety

But as much as “This Is Us” is a triumph for NBC, it hails from a competitive studio in an era that prioritizes vertical integration. The previous head of NBC’s in-house studio, Bela Bajaria, now VP of content acquisitions at Netflix, was reportedly pushed out for not generating enough shows for the network.

“Yes, it would be nice for the next big thing we accomplished to have been a big homegrown hit, too,” says Salke. “But I’d take anything — if it came from outer space — if it was this kind of project that had this effect on me and everyone.”

***

Back on the set of “This Is Us” a few days later, filming the season-one finale in a club in downtown Los Angeles, there’s trouble in what was once Pearson paradise. Rebecca’s pursuit of her singing career has caused a rift in the marriage, and Jack has been drinking again. It all leads to a finale that Fogelman says is “definitely the darkest place we’ve been.”

“We’re going to destroy America by the end of the season. As if they don’t have enough to be upset about at this point in time anyway,” says Moore. “But they’re going to be upset for a completely different set of reasons.”

Right now, no one is more upset than director Ken Olin, who’s grumbling about the extras. They’re not acting naturally enough for him — “Are they zombies?”

he complains. For him, authenticity is paramount.

Fogelman recruited Olin after the pilot to help set the tone, along with directors-executive producers John Requa and Glenn Ficarra. Though Fogelman teases that he’s never seen “thirtysomething,” in which Olin starred, the parallels are inescapable. Even the episode being filmed today — which contrasts Jack and Rebecca’s first meeting in the ’70s with their marriage in later years — recalls a famous episode of the classic ’80s drama, “First Day/Last Day,” which intercuts the day Michael Steadman and Elliot Weston launched their advertising business with the day they had to sell it.

“People may find it overly emotional,” says Olin of “This Is Us.” “It is earnest, but I don’t think of it as earnest in a false way. It’s that part of our lives where we behave in a way that reflects genuinely caring about something. These people have some damage, but they’re not psychopaths. They have weight issues. They’re losing their parents. They’re dealing with racism. They’re trying to be good human beings and figure out the best way to take care of people they love.”

Fogelman calls the finale “incredibly ambitious” for the way it jumps between time periods. “There is a scene with Milo and Mandy that I have not seen on television,” he says. “I think it’s going to rock people.”

Normally Ventimiglia’s chair is right next to Moore’s on set; the two actors talk constantly between takes. But filming the finale, he says, “I felt very removed. We were coming together to make something great, but it didn’t feel good at all.”

“Dan has made right choice after right choice. It all comes from a very good place, a very earnest place. There’s nothing contrived about what he’s doing. He’s not trying to prove a point. He’s just telling stories that strike him ­— that wake him up in the middle of the night.”

Milo Ventimiglia

Bryce Duffy for Variety

The final scene, says Fogelman, is what he intended from the moment he pitched the show. “Not because I’m a genius who thinks that way,” he says. “I just always had a shape in my mind for what the final story was going to be. Normally when you have a plan it tends to disappoint a little bit, but it’s exactly what I hoped for.”

And while it’s going to be upsetting, he says, “there is, in the strangest way in the end, hope and optimism that is really beautiful.”

He contrasts his storytelling style with that of “Manchester by the Sea,” a movie he loves. “But I’m probably never going to write that movie, and I’m certainly never going to write that ending. I get it. I admire it. I appreciate it,” he says. “But the world is f—ed up and hard enough as it is. Getting to make stuff that’s entertaining and soulful that is ultimately still uplifting is still the sweet spot that I’m interested in living in.”

Fogelman, 41, claims not to spend much time on social media, but he’s well aware of the online obsession about Jack being a perfect husband and father — and knows there’s going to be some fallout from the finale.

“He’s not going to be perfect forever. He’s not going to ever turn into Darth Vader — because that’s not what we do — but it’s a challenge for the show,” he says. “Can America, on this big, broad, accessible network television show that we aspire to make, also deal with the ugly parts of these characters who we love so much? But if we don’t get into some of the darker stuff from these characters, you don’t really have a television series.”

Another challenge: being able to stretch out the mystery around Jack’s death without frustrating viewers. Ditto redeeming Miguel (John Huertas), Rebecca’s second husband (and Jack’s best friend).

“The biggest magic trick we can ever pull off as writers is getting viewers invested in the Rebecca/Miguel relationship,” Fogelman says.

But as much as he’s holding back secrets from viewers, he’s an open book for his cast. They’re all invited into the writers’ room, where the (very complicated) timeline of the Pearsons’ lives is chronicled on the wall, lest the writers fumble.

“Our writers’ room looks like the end of ‘A Beautiful Mind,’” he says with a laugh. “We’re pretty mapped out. I know where the series is going, and there’s going to be things between the lines that we have to figure out, but I know what the big moves of next season are. We’re not going to be suddenly stuck without a plan in season three or four.”

Fogelman staffed the room with a team of writers nearly all younger than him. Isaac Aptaker and Elizabeth Berger, who’ve worked alongside him for years, have been elevated to co-showrunners for season two in a new deal with 20th Century Fox TV. “The tone of the show is extremely hard to capture on the page, and it happens to land right in their wheelhouse,” he says. “They’re very funny and can write whip smart ‘banter,’ but then they can turn on a dime and write the hell out of a dramatic monologue, too. They’ve become decisive leaders in the room and in production. I’m equal parts proud of them and grateful for them.”

“I don’t think there’s an episode that’s gone by where I haven’t gotten a little wrecked, to be honest with you, and I’m not really a crier.”

Justin Hartley

Bryce Duffy for Variety

Fogelman demanded a lot of all of his writers — and they delivered. “It’s a lot of very smart, big-brained people who came in on day one willing to reveal the darkest, most formative moments of their childhood and lives,” he says. “It all went right into the show.”

As did much of his own life. Fogelman admits that much of “This Is Us” is autobiographical — his friends, his family, his marriage. He lost his own mother eight years ago.

“We were very close. She was very young, and it’s the big, defining moment of my life,” he says. “I didn’t think about it once when writing it, but now, 18 episodes in, there are moments I see so much of my mom in Mandy’s character that the hair on my arm stands up.”

His sister, Deborah, also serves as an inspiration — and a reality check — for Metz’s character, Kate.

“There were a couple of monologues when I was like, this is so spot on, these are words I’ve said before,” says Metz. “I was like, Dan, who did you talk to about this? He related the fact that he was the brother of a sister who had struggled with feeling inadequate and weight issues and never really measuring up.”

What he doesn’t know through personal experience he’ll research: an expert on transracial adoption spoke to the writers’ room early on.

But what all of the actors say is how Fogelman has an uncanny ability to channel their characters’ voices. “If I read a line from ‘This Is Us’ season two, I could tell you who’s saying it,” says Hartley. “The characters are that well fleshed out.”

Ultimately, says Brown, Fogelman is Randall: “Everyone looks to Dan to be like, what should I do in this particular situation. I think there’s a lot of personal connection that he has with the character that may help him tell our story.”

That’s a comparison Fogelman accepts. “I relate to Randall a lot, which is interesting, because Sterling’s, like, this incredibly noble, beautiful, black guy, and I’m, like, this somewhat inward white guy,” he says. “I love that character who’s trying to be so good for all the people in his life all the time that it’s actually not always a skill set. It’s actually not being truthful to what he really needs as a human being. I identify with that a lot. I spend a lot of my time worrying what people are thinking about me.”

And he swears he’s not purposely trying to make America cry. “People talk a lot about the crying, which caught me off-guard,” he says. “I thought the show was going to move people, and I felt people were really going to like it.”

Jokes Ventimiglia, “Seriously, I’m surprised that some kind of tissue company hasn’t stepped up and said, “OK, let’s call it Tuesday tissue night.”