Tim Kurkjian explains how the Orioles and Chris Davis came to terms on a seven-year, $161 million deal to keep the slugger in Baltimore. (1:55)

Chris Davis and the Orioles have agreed to a seven-year, $161 million deal for the slugger to remain in Baltimore, sources told ESPN's Jerry Crasnick and Buster Olney.

The deal, which was first reported Saturday by the MLB Network, is pending a medical review.

Davis will receive a $17 million annual salary from 2016 to 2022 and will receive additional annual payments through 2037, when he will be 51, a source told Olney. There is no interest accrued on the deferrals.

The sides reached an agreement less than two days after the Orioles, frustrated by stalled negotiations with Davis, reportedly made an offer to free-agent outfielder Yoenis Cespedes.

Cespedes is no longer a consideration in Baltimore now that Davis has re-signed with the Orioles, a baseball source confirmed.

Davis, who filed for free agency after the 2015 season, reportedly balked at an earlier offer made by Baltimore reportedly worth about $150 million. Orioles manager Buck Showalter lamented about the protracted contract talks earlier this week.

"How much is enough?" Showalter said Wednesday during a leadership conference, according to the Baltimore Sun. "I asked Chris during the season, 'Chris, when you walk into a Target store, can you buy anything you want? So, how much is enough?'

"I love Chris, but if that [his decision] makes or breaks our team, shame on us."

Davis, 29, has been with the Orioles since 2011. He belted 47 home runs with 117 RBIs last year and has 126 homers in the past three seasons.

Davis is the third significant member of last season's Orioles roster to re-sign this offseason. Catcher Matt Wieters accepted a $15.8 million qualifying offer in November, and reliever Darren O'Day agreed to a four-year, $31 million contract in December.