O'Brien finalizing exit from NBC

Payoff said to be close to $40 mil; last taping expected Friday

Conan O'Brien's "Tonight Show" dream is over.

NBC brass certainly are praying that the same can be said for the PR nightmare that the late-night debacle has caused the network.

On Sunday, attorneys from both sides were putting the final touches on a financial settlement that ends O'Brien's seven-month stint as "Tonight" host.

The payoff to O'Brien is said to be close to $40 million.

The pact also includes sizable severance packages for O'Brien's longtime executive producer Jeff Ross and the rest of the "Tonight" staff, some of it possibly coming out of O'Brien's settlement paycheck.

O'Brien is expected to tape his last "Tonight Show" on Friday. Jay Leno will return to the "Tonight" desk March 1.

The settlement caps a week of tense negotiations and public salvos from both sides, including O'Brien's open letter defying NBC's plan to move his "Tonight" to 12:05 a.m. to make room for a Leno-hosted half-hour show at 11:35 p.m. and NBC's sports chief Dick Ebersol's slam of "gutless" O'Brien.

The quick resolution would be welcomed by NBC and Leno, who have found themselves under siege for the past week, blasted by late-night comedians for pushing O'Brien out.

In addition to gaining momentum in the PR war with NBC, O'Brien also saw his sluggish "Tonight" ratings -- a big reason for his ouster -- surge last week.

Under the settlement with NBC, O'Brien is expected to be free to join another network, possibly right away and by the fall at the latest.

News Corp. has been the most inviting company, with the toppers of two of its networks -- Fox's Kevin Reilly and FX's John Landgraf -- expressing strong interest in bringing O'Brien into the fold.

Shedding O'Brien and putting Leno back in charge of "Tonight" gives NBC the opportunity to get its schedule back on track, but it comes at a very high cost. The network's pilot development last year was derailed with the vanishing of its 10 p.m. dramas that made room for "The Jay Leno Show," which was canceled last week.

The network also spent millions on new sets and the launch of both "Tonight" and "Jay Leno" and then had to face ratings down spiral both at 10 p.m. and 11:35 p.m., which led to revenue loss.

(Leno, at least for the time being, is expected to stay put in the studio that housed his primetime show.)

Additionally, the NBC and "Tonight Show" brands arguably have been tarnished.

The network, in particular, has been painted as clumsy at best and villainous at worst in its handling of the issue.

And then there is NBC's loss of O'Brien -- a star at the network whose passionate fans were planning to stage a support rally today outside NBC Universal studios -- with an excellent chance of him becoming a competitor to boot.

Matthew Belloni and James Hibberd contributed to this report.