The Milwaukee Brewers reached agreement on a two-year contract with free-agent right-hander Jhoulys Chacin.

The contract was officially announced by the team Thursday and will pay Chacin almost $8 million per year, a source told ESPN.

"I have been really working hard to get to the point where I can pitch and don't think about anything (except) making outs, making my pitches," Chacin said. "I was able to do that -- just go out and have fun pitching."

Chacin joins Yovani Gallardo as the second free-agent pitcher to sign with Milwaukee over the past week. Gallardo's deal also was announced Thursday.

"We all know that the last couple years haven't gone (well) for me," Gallardo said. "I think it's just a matter of minor adjustments."

Chacin and Gallardo are expected to give the Brewers innings to help compensate for the loss of Jimmy Nelson, who underwent shoulder surgery in September and could miss a significant portion of the 2018 season.

Chase Anderson and Zach Davies are Milwaukee's top returning starters, while Brandon Woodruff and Brent Suter could be in the competition for starting spots in spring training.

In 32 starts last season for the San Diego Padres, Chacin was 13-10 with a 3.89 ERA and a career-high 153 strikeouts. His 1.79 home ERA was the fourth lowest in Petco Park's history.

Chacin, 29, has pitched for five teams over eight major league seasons, including six seasons with the Rockies (2009-2014). He has a career record of 59-67 with a 3.93 ERA in 195 games (167 starts).

He has won 10 or more games and pitched more than 180 innings three times. His best season came in 2013, when he went 14-10 with a 3.47 ERA in 197⅓ innings over 31 starts for the Rockies.

Information from The Associated Press was used in this report.