Lewis' return comes after days of discussions with Bengals owner Mike Brown. On Monday, Lewis repeatedly said the talks were all about "getting on the same page," but did not elaborate as to what that meant.
"Marvin Lewis has been an important member of the Cincinnati community and the Bengals family for the past 15 years, and we are happy to have reached this agreement," Brown said in a statement. "Marvin has made significant contributions during his time here. While recently we have fallen short of our expectations, we have full confidence in Marvin to re-establish winning football in 2018."
The Bengals wrapped up a 7-9 season Sunday with a 31-27 victory over Baltimore.
Lewis is the NFL's second-longest-tenured coach, behind only Bill Belichick of New England. Lewis is coming off two disappointing seasons and has no playoff wins during his 15 years with the team — the longest tenure in franchise history — despite seven trips to the postseason.
"My family and I are very grateful for the opportunity to stay in Cincinnati and continue my career with the Bengals," Lewis said in a statement. "My job is to win a World Championship. We have a talented roster full of veteran leaders and emerging young stars, and I am committed to making the necessary improvements to put this team in the best position to win."
ESPN reported last month that Lewis planned to leave after the season. But Lewis always planned a postseason sit-down with owner Mike Brown, and sources say Brown was able to address Lewis' concerns enough to convince the coach to sign on for two more years. Coaches and people in the organization, expecting Lewis to leave, were surprised and pleased to learn he would be staying, according to sources.
Lewis, 59, may have been seeking more control over changes in the staff and the ability to be more aggressive in free agency. The Bengals value continuity and rarely make staffing changes. Some of the assistants, including offensive line coach Paul Alexander, have been with the franchise since before Lewis arrived or since his first season.
Defensive coordinator Paul Guenther, a potential candidate to replace Lewis had the team changed head coaches, will leave the organization to pursue opportunities elsewhere, a source told ESPN.
Guenther has an expiring contract, and he is expected to be a leading candidate to become defensive coordinator with the Oakland Raiders?when Jon Gruden takes that job, a source told ESPN's Adam Schefter.
The Bengals rarely pursue big names in free agency and prefer to build through the draft. They've also lost some of their best players to other teams, including Andrew Whitworth, Kevin Zeitler and Marvin Jones, all of whom would have likely helped their last-place offense.
Although the 11th-hour return is surprising, there is a precedent for it. Lewis last went into the final year of a contract in 2010, but he ended up returning. Lewis and Brown had not come to an agreement prior to that season, partially because Lewis was seeking some concessions from Brown, including more control of personnel. Lewis and Brown decided to move forward together after two days of discussions following a 4-12 finish that season.
The Bengals began their run of success after that, drafting quarterback Andy Dalton and wide receiver A.J. Green and making a run of five straight playoff berths.
Lewis helped rebuild a Bengals franchise that was considered an NFL's laughingstock when he accepted the job in 2003. The Bengals have won four AFC North titles under Lewis.
He has posted a 125-112-3 record in his 15 seasons and is the Bengals' all-time leader in wins, losses and postseason appearances.?He is the only coach in NFL history to lose his first seven postseason games, according to the Elias Sports Bureau.