O'Brien (l) took over from Leno (r) as Tonight Show host in June 2009
NBC has reached a $45m (£28m) agreement with Conan O'Brien over his late-night US talk show, paving the way for his predecessor Jay Leno to return.
O'Brien, 46, will be paid in excess of $33m (£20m) to end his seven-month reign as host of The Tonight Show, with the remainder going to his staff.
The deal allows Leno, 59, to return to the show, a programme he hosted for 17 years before leaving last May.
O'Brien, who took over in June, will host his final programme on Friday.
Actor Tom Hanks is scheduled to appear, as is comedian Will Ferrell - O'Brien's first guest as Tonight Show host when he began his stint last year.
Leno will return to The Tonight Show on 1 March, NBC announced on Thursday.
The deal brings to a close an ignominious battle that has seen both hosts discuss the dispute on NBC's own airwaves.
It will also allow Leno to bounce back following the failure of his 2200 prime-time show, launched in September, to pull in audiences.
O'Brien, who used to host a show in a later slot before filling Leno's shoes, will be allowed to return to TV in eight months.
"He just wants to get back on the air as quickly as possible," his manager Gavin Polone told the Wall Street Journal.
It is unclear, though, whether any of NBC's rivals will be prepared to sign him up following The Tonight Show's ratings slump during his tenure.
The dispute has provided plenty of comic material for O'Brien's late-night competitors, among them veteran broadcaster David Letterman.
The 62-year-old, who hosts The Late Show on CBS, had been expected to take over The Tonight Show from the late Johnny Carson prior to Leno's appointment.