A source told ESPN that the deal is worth $80 million.
"You definitely don't want to be out there too long. It's definitely chilly out there," Cain said Friday of the slow-moving free-agent market. "But Milwaukee was in on me from the get-go -- other teams as well -- and once I got a phone call from David, this was the spot I wanted to be in."
Cain's new contract is the longest term and biggest payout of any MLB free-agent deal this offseason. It surpasses Carlos Santana's three-year, $60 million contract with the Philadelphia Phillies in December.
The deal includes no-trade protection and award bonuses of $300,000 for each All-Star team Cain makes and $500,000 for an MVP Award, the source said.
"Lorenzo is a multifaceted player and proven winner who we are pleased to welcome back to Milwaukee," general manager David Stearns said in a statement. "His combination of speed, fielding prowess and ability to hit for average will be a valuable addition to our lineup."
Yelich and Cain report to a team that came one game short of making the playoffs last year. Milwaukee went 86-76 in the second full year of a rebuild, and the timeline for a return to pennant contention has accelerated.
"There's not a place I don't think it doesn't make us better offensively and defensively," said manager Craig Counsell, who was teammates in Milwaukee with Cain in 2010. "Lineup, in the clubhouse, experience -- so there [are] a lot of places that we feel like we got better yesterday."
Cain, 31, returns to the organization where he began his professional career. He was a 17th-round pick by the Brewers out of Madison County High School in Florida in 2004 and broke into the majors with Milwaukee in 2010.
The following year, the Brewers sent Cain, Alcides Escobar, Jake Odorizzi and Jeremy Jeffress to Kansas City in a trade for pitcher Zack Greinke. Cain made the 2015 All-Star team, finished third in American League MVP balloting and was a pivotal member of Kansas City's 2015 world championship team. He hit .289 with 56 home runs and 308 RBIs in 713 games with Kansas City.
Cain is a career .290 hitter who is known as an exceptional defender. He was an AL Gold Glove finalist in center field last season along with Toronto's Kevin Pillar and Minnesota's Byron Buxton, who won the award.
"He's one of the rare, true five-tool players in baseball right now," Stearns said.
The Chicago Cubs, Los Angeles Dodgers, San Francisco Giants, Cleveland Indians and Toronto Blue Jays were among the other clubs that had expressed interest in Cain before he reached agreement with Milwaukee.
Under baseball's collective bargaining agreement, the Brewers will lose their third-highest pick in June's amateur draft and the Royals will gain an additional pick after the first round as compensation.
The Associated Press contributed to this report.