Having earned hundreds of millions of dollars for hosting “The Tonight Show” over the past twenty­­something years, Jay Leno might not look like a working-class hero. Yet there’s something people can identify with in his relationship with NBC, where corporate bosses have rewarded his loyalty and work ethic by twice elbowing him aside to make room for newer models.

Leno is preparing to end a second stint as host of the venerable franchise on Feb. 6, having once been briefly replaced by Conan O’Brien and subsequently reinstated. Four years later the 63-year-old comic is stepping down again, this time to clear the way for Jimmy Fallon — at 39, almost a quarter-century his junior.

Although it’s been all smiles of late — after NBC stumbled in announcing the latest plan amid awkward leaks — the network is left in the familiar position of hoping its current workhorse, now that much closer to retirement age, will settle for some sort of emeritus status, becoming the equivalent of Bob Hope in his golden years as opposed to a competitor elsewhere.

In an exit interview with Variety, Leno adopted a posture that’s become as regular a part of his persona as his monologue: the genial nice-guy, who insists he’ll be fine and doesn’t merit any sympathy. Sounding a bit like Johnny Carson, he says, “When you stop, you stop. … When you’re older, you just sort of slow down and look for other things to do.”

In showbiz, he told “60 Minutes’” Steve Kroft, “eventually you’re going to get screwed” — making a joke about the incongruity of NBC wanting to change jockeys when its horse is running first.

“It happened to Johnny. It happened to me,” Leno said. Unlike most jobs, “The Tonight Show” is “sort of a dynasty. Every host leaves at No. 1.”

Leno may sound like the news went down easier this time because NBC consulted with him about its plans, and he considers Fallon “an extremely qualified young guy ready to step in,” as he told Kroft. (On its face, it’s hard to see why Fallon would be deemed more worthy than O’Brien, who put in a dozen years as an understudy.)

No, what Leno appeared to want — and genuinely deserved, given how successful he’s been while weathering NBC’s turbulent primetime performance through the years — was the right to dictate his departure, to be able to go in and say, “OK, I’ve had enough, bring in the next guy.” That was the wholly dignified exit, to outside appearances, he’s been denied.

By contrast, CBS — in what amounts to an endorsement of institutional continuity — has been wise enough to leave David Letterman alone.

Asked if he deserved similar deference, Leno just laughs. “Welcome to real life,” he says.

To be fair, Leno himself was the beneficiary of a similar demographic turn when NBC decided it was time to replace Carson. Moreover, he won the job in part by being a more compliant employee than ostensible heir-apparent Letterman, glad-handing his way through appearances across the country and ingratiating himself to the network’s affiliates.

At NBC, Leno has endured a series of different management teams that frequently appear more concerned about potentially losing the next guy than keeping the one they have happy. About as far as he’ll go is to acknowledge feeling “blindsided” when the network first indicated it was taking steps that would lead to his departure a decade ago.

Yet while he likened the feeling to being jilted by a lover, the downsized-worker framework is more accurate. TV is a business, after all, and few NBC execs have hung around long enough for the situation to get personal.

Bill Cosby, in his recent Comedy Central special, told a joke about his then-school-age children worrying that friends would perceive them as being rich. Cosby assured them not to fret, telling the kids they weren’t rich, “Your mother and I are.”

Boasting about his wealth isn’t a gag Leno would normally tell, and as much as the media love the Shakespearean aspect of “Tonight Show” succession stories, he’s always downplayed the drama surrounding the latenight throne, suggesting nobody should shed any tears for him, Letterman or O’Brien.

Even so, for a shifting workforce — and especially Leno’s contemporaries, who have discovered corporate loyalty is often a one-way street — the comic’s ability to speak for a broad swath of America is no doubt enhanced by his “You’re only as good as your last monologue” work history.

Notably, “60 Minutes” framed its coverage of latenight’s latest handover in the context of a larger cultural shift under way. Kroft went so far as to say Leno’s exit is “part of a demographic shift that is beginning to affect millions of baby boomers being pushed aside to make way for a younger generation — the inevitable changing of the guard.”

That’s hardly new, of course, and Jay Leno is no run-of-the-mill baby boomer, what with an airplane hangar full of cars to occupy him. Yet couched in those terms, anybody getting older who has taken it on the chin can probably relate.