The Baltimore Orioles have agreed to a seven-year, $161 million deal to keep free-agent first baseman Chris Davis.

Breaking: Chris Davis is heading back to the Orioles. sides are in agreement.

— Jon Heyman (@JonHeyman) January 16, 2016

davis gets $161M for 7 years #orioles

— Jon Heyman (@JonHeyman) January 16, 2016

More from FoxSports

Source confirms: Chris Davis back to #Orioles, seven years, $161M, pending medical review. First reported: @Jonheyman.

— Ken Rosenthal (@Ken_Rosenthal) January 16, 2016

Davis reportedly had been weighing a seven-year deal worth more than $150 million from the Orioles since early in spring training. That deal reportedly had been on and off the table as the Orioles considered other options.

In fact, it was reported Thursday that the Orioles had made a sizeable offer to free-agent outfielder Yoenis Cespedes.

But in the end, Davis will remain with Baltimore, where he has spent the past five seasons.

Davis led the majors with 47 homers and 208 strikeouts last season, when he hit .262/.361/.562 with 117 RBI. Since the 2012 season, Davis leads the majors with 159 homers and 749 strikeouts.

As for Cespedes, it remains to be seen whether the Orioles remain interested in him or whether the deal for Davis ends that pursuit.