Veteran starter Alex Cobb stayed in the division he knew best, as the former Tampa Bay Ray agreeed with the Baltimore Orioles on a four-year contract, the team announced Wednesday.

The deal is worth close to $60 million, FanRag Sports first reported.

The 30-year-old right-hander posted career highs for wins, games started and innings pitched while going 12-10 with a 3.66 ERA over 29 starts with the Rays in 2017.

"They used the AL East and the success I've had in it to their advantage," Cobb said. "They kept challenging me with it and I love the challenge of pitching in this division and they know that over the times we talked. They did a really good job of making me feel like this is where I need to be."

He had turned down the Rays' $17.4 million qualifying offer in November, and Baltimore pursued him from the start of free agency.

"They didn't stop bothering me the whole offseason," Cobb said.

Cobb's career year for the Rays marked his comeback from Tommy John surgery, which sidelined him most of the previous two seasons. He went 1-2 with an 8.59 ERA in 2016 after returning late that season from the ligament-replacement procedure.

Cobb ranks fifth in wins and second in ERA on the Rays' career list with a 48-35 record and 3.50 ERA over six seasons.

The deal with Baltimore is the largest the Orioles have committed to a free-agent pitcher by total value and average annual value.

Cobb joins Andrew Cashner and Chris Tillman, who were signed last month, in a revamped rotation that includes holdovers Dylan Bundy and Kevin Gausman. The Orioles are coming off a last-place finish and 75-87 record.

Baltimore opens on March 29 at home against Minnesota, but Cobb won't be ready to pitch then. He has agreed to be optioned to a minor league affiliate to help build up innings.

"I'm going to be pushing it as quick as I can," he said.

ESPN's Jerry Crasnick and The Associated Press contributed to this report.