Pamela Fryman, Neil Patrick Harris

On the last day of production of How I Met Your Mother, Alyson Hannigan and co-creator and executive producer Carter Bays implored fans to get #PamFryman trending on Twitter.

"I am the one person who is not on Twitter. At one point, I got a text from one of my kids that said, 'Mom, you're trending,'" Pamela Fryman, the show's longtime director, tells TVGuide.com. "I was like, 'Is that good?' Carter, when he found out, started hashtagging me up. It was so funny. I was like, 'Guys, I'm trending!'"

How I Met Your Mother: A chronological timeline of craziness

The Twitter love-fest was not merely a public display of affection, but a public display of gratitude. Cristin Milioti might play the titular Mother, but the show's true matriarch — or "set mom" — is Fryman.

A veteran of Frasier, Just Shoot Me and Two and a Half Men, Fryman has been with HIMYM since the pilot and has helmed 196 of the show's 208 episodes, counting Monday's one-hour series finale. Outside of James Burrows directing every episode of Will & Grace and a majority of Cheers, such longevity and a singular voice and leadership in the director's chair are rare on long-running shows, which usually have a stable of directors or outsource them.

"I think we're all inherently nice people and try to be nice people, but Pam Fryman has set a tone on set from Season 1 where it was, like, the thing that took precedence over anything was that we all get along and that we all be kind and good to each other, and that the set be a pleasant place to be," Jason Segel says. "I can't imagine doing this for nine years in a different sort of environment, and I don't think it was just being smart. I think it's who Pam is in her heart. This has been like the nicest place to come for nine years. ... I've learned a lot just from being around Pam."

Adds Josh Radnor: "I can't imagine the show without Pam. This whole experience and the show would not be what it is without her."

Beyond her nurturing, warm guidance, Fryman also set the show's identity. Though HIMYM is Bays' and co-creator and executive producer Craig Thomas' baby, Fryman is the one who brought it to life. The duo had envisioned the comedy as a traditional multi-camera sitcom, but their pilot script, with its multiple time-jumps and cutaway jokes, resembled a one-hour drama with up to 60 scenes. "We were a little ambitious," Thomas quips. "If it weren't for Pam, we might not be on the air." Fryman's solution? An ingenious hybrid method that married the broad feel of multi-camera sitcoms with the stylish editing of single-camera comedies by shooting the show without an audience.

"This show is different because so many of the laughs are not only within the scenes, but in the transition from one scene to another," Fryman says. "You're not really laughing at the end of the A scene until you see what you're cutting to in the B scene, so there was just no way it was going to be pleasing to an audience. We had to do it without one."

How I Met Your Mother: Ranking Ted's girlfriends

The benefit of a live studio audience is getting immediate reactions to jokes and punchlines, but the lack of one fostered a tight-knit bond between the HIMYM cast and crew, and taught them to trust themselves. "The beauty of this show was we were able to look at each other and say, 'That's great,' or 'What else can we do?'" Fryman says. "We had the luxury of time because we didn't have to get the audience on their buses to go home. I was the one screaming at the cast, 'Energy!' They would always laugh at me because you have to keep it up when you have no audience. We had to create that for ourselves. Our crew provided that audience feel. Ultimately it all worked out well. It was tough in the beginning, but we got good at it."

Though Fryman "fell in love" with Bays and Thomas, and the show pitch during their initial meeting at a Starbucks in 2005, there was never a concrete plan at first for her to direct beyond the pilot. After CBS ordered the show to series, she jumped at the chance to continue with it.

"It turns out I'm a very small person because I just wouldn't give it up!" she says, adding that she and Bays and Thomas balanced each other out. "I had been doing this for a while, and Carter and Craig were new to this. I knew things that I could help them with and they were the creative geniuses behind it. It just was so much fun that I didn't want to leave and fortunately, they didn't want me to go anywhere, and I got to wrap it up, which is amazing. But at that moment then, it never occurred to me that nine years later, I'd be there — nevermind all the things we did in these nine years."

HIMYM's non-linear, from-the-future narrative structure and excess of scenes (they've shot 9,125 scenes in total), naturally, made particular episodes difficult to shoot. But they also gave way to inventive, memorable moments (Two-Minute Date, anyone?). There was nothing Bays, Thomas and the writers came up with that Fryman didn't find a way to make it onto the screen somehow.

8 things to know about HIMYM's final episodes

"Certainly when some outlines and scripts came out, we were like, 'It turns out we don't have time to do this. Can we do this instead?' But there was never like, 'C'mon, how are we going to do that?' Cockamouse was the most ridiculous thing, but we laughed so hard," Fryman says. "The most difficult ones are the ones you don't think are going to be difficult. ... Early on, Carter and Craig ... were thinking, 'We're going to do a show all in a limo. How easy is that?' They were so proud of themselves. Well, shooting in a car is really tough! They were like, 'Aw, man! We really don't get it.' The big ones — the 100th with the huge number from Neil [Patrick Harris], the Farhampton set with the rain — they were all challenging, but in a wonderful way. 

"The great thing is it made us all better; it certainly made me better," she continues. "If you had told me that I was going to be doing all these things, I would've said, 'You probably should get someone else.' It was so exciting and everybody pitched in and did what they could do. ... It's such a team effort that the most challenging stuff is usually the most fun stuff. I think we've done it all. We were kind of creating stuff as we went. I don't think we ever couldn't do something."

The toughest episode for Fryman had nothing to do with set-ups, limos, musical numbers or tracking shots, but saying goodbye. The last scene shot was "brutal" — though it's not the last scene of the finale, which Fryman assures will be "very satisfying" to longtime fans, if you're one who subscribes to the Dead Mother theory. A week prior, the five main cast members filmed their final scene together, which is also not the show's last scene, as Segel had film commitments.

"You could've heard a pin drop on that stage," Fryman says. "To see the five of them after nine years still loving each other, still respecting each other and just being this fantastic ensemble, it was — as a mother, forgive me, because that's what I am — just tough. They made me do the slate, which was hilarious. Then I got to watch these five people that I love so much and I'm so genuinely proud of. I think everybody that knows this show and has been on this ride with us will really get to see how much these people mean to each other, as characters and as people off-screen."

How I Met Your Mother: Does it matter if The Mother is dead?

Of course, the feeling is mutual. On the penultimate day of production, the cast and crew lured Fryman — because of a "fire drill" — to the studio lot, where they surprised her with a huge banner.



"We go outside and I'm standing facing away from the stage and I turn around and they have hung a banner on Stage 22," she says. "This will tell you what kind of an experience this has been for me. They were trying to get me to cry the whole week. I did not cry then. ... When we finally wrapped, literally when I did the last shot, I started talking. I didn't plan to, but there were just some things I wanted to say. My voice cracked. Everybody was like, 'Oh!' I was like, 'OK. Everybody got what they wanted. Here I go. You're happy.' I thought I held it together long enough. I'm forever indebted to Carter and Craig. It's really been the most remarkable nine years of my career."

How I Met Your Mother's series finale airs Monday at 8/7c on CBS.

(Full disclosure: TVGuide.com is owned by CBS.)