When “The Simpsons” ends its 30th and current season this spring, it will have racked up 663 original episodes — having a season ago passed “Gunsmoke” (635) as the longest-running scripted program in television history. But with the Walt Disney Co.’s acquisition of 21st Century Fox pending, one of TV’s least likely institutions could prove more valuable to its new owner in retirement than as a going concern.

Sources with knowledge of negotiations tell Variety that FBC and studio 20th Century Fox Television are near completion of a deal to renew “The Simpsons” for a 31st and 32nd season. The terms of the agreement, which includes a licensing fee that’s slightly reduced from what the network paid under the last renewal, reflect the reality of the shifting economics around the show.

Representatives for Fox and Disney declined to comment for this story.

“The Simpsons” has traditionally been a loss leader for Fox Broadcasting. The network sheds money on a per-episode basis — with costs increasing over the years. But those losses have been more than offset by the money the show makes for the studio. When corporate sibling FX Networks secured cable and streaming syndication rights for the show in a 2013 deal valued at the time at as much as $750 million, the back end for 20th increased dramatically.

But after the Disney deal is complete, FBC and 20th Century Fox will no longer share a balance sheet. The network will remain in the hands of Rupert Murdoch’s slimmed-down New Fox, while the studio will become part of the Disney-ABC Television Group. Fox Broadcasting will, for the first time, have to stomach the costs of “The Simpsons” in full. And Disney will have to decide how the show fits into what will be the entertainment industry’s largest and most valuable content portfolio.

Complicating matters is an untapped well of money hidden in Springfield. Being as old as it is, “The Simpsons” is a relic of a bygone television era. When the first broadcast syndication deals were set for the show in the early 1990s, they were exclusive and open-ended — meaning they ran for as long as the show continued to air original episodes on Fox. Such deals were once common, meant to provide security for producers in a world where cable syndication barely existed and streaming was decades away. But in the case of “The Simpsons,” the original deals have kept the Fox studio from being able to fully exploit the show’s value.

When the FX deal, which expires in 2023, was set, Fox had to get permission from the stations to which it had originally licensed “The Simpsons” for an exception covering cable and streaming. But no new broadcast deal can be cut until the show leaves FBC. If “The Simpsons” were to end its run on Fox with its 32nd season, that would free Disney to negotiate a new deal or deals covering broadcast, cable and streaming that would potentially dwarf the $750 million paid by FX.

“It’ll set a record because it will be such a huge library,” media consultant Brad Adgate says.

Disney has a multitude of options. One source tells Variety that Fox has long mulled breaking the show’s episodes — more than 700 by the end of Season 32 — into three batches that would rotate among multiple licensees. Such a strategy could attract more money on a per-episode basis than could be drawn from a single deal partner. Disney also could opt to forgo an outside deal and instead use “The Simpsons” as a platform on which to build out Disney Plus or Hulu in much the same way that FX used it to establish then-nascent offshoot FXX.

But those options would require FBC to walk away from the program. Despite costs, insiders say, “The Simpsons” is integral to the network’s identity in a unique way. And the new renewal deal reflects the reality that for both Fox and Disney, the status quo is the best option — for now.

“When the show ends, I would think that it will be because the creators of the show and the producers don’t want to do it anymore, not because two

media conglomerates got together,” Adgate says. “I think the show deserves a better ending.”