Cain's contract is for six years (2012-17) and $127.5 million with a vesting player option for 2018 that can bring the total to $141 million over seven years, sources told ESPN The Magazine's Buster Olney. It also includes a full no-trade clause.
There is $112.5 million of new guaranteed money over five years. The guaranteed money includes a $5 million signing bonus and a $7.5 million buyout in 2018. That year has a player vesting option for $21 million.
Cain's option would become guaranteed if he pitches 200 innings in 2017 or 400 innings combined in 2016-17 and is not on the disabled list at the end of the 2017 season for a right elbow or right shoulder injury, The Associated Press reported. If it does not become guaranteed, it would be a team option.
"This is a decision that was made pretty simple for us. It was a process and it was a negotiation. It was good for my family and I to go through all of that," Cain said, his wife Chelsea in the back of the room for his news conference. "To be able to know this is probably going to be our lifetime as a Giant, that's pretty cool for us."
One of general manager Brian Sabean's top priorities this offseason had been to keep his talented pitching staff intact -- and president and CEO Larry Baer has been onboard all along. Two-time NL Cy Young Award winner Tim Lincecum agreed to a $40.5 million, two-year contract in late January.
"Ensuring that Matt remained a Giant beyond this season was a top priority for the organization. Matt is an integral part of the team whose performance on the mound will be one of the keys to our success for years to come," Sabean said.
Among pitchers, only the Yankees' CC Sabathia and the Mets' Johan Santana, both left-handers, agreed to larger contracts. Sabathia got a $161 million deal from 2009-2015 that had an additional year and $30 million in guaranteed money added last fall. Santana agreed to a $137.5 million contract from 2008-13.
The previous record contract for a right-handed pitcher was Kevin Brown's $105 million, seven-year deal with the Dodgers after the 1998 season.
"It's an honor to be in this situation. We're trying to take that all in and embrace it," Cain said. "It's great to be mentioned with any of the names in that category. It's nice to be spoken in the same sentence with Santana and Sabathia."
The 27-year-old Cain went 12-11 last season with a 2.88 ERA, reaching 200 innings for the fifth straight season. He also didn't allow an earned run during the entire 2010 postseason, when the Giants pulled off an improbable World Series championship.
"This kid literally has gotten better each year and has proven that under very difficult circumstances," Sabean said.
Cain, represented by CAA Sports, never named his price tag or the number of years he sought, other than to say during spring training he wanted "fair value." Several other top pitchers around the majors have signed similar contracts for five years -- Phillies ace Cliff Lee ($120 million), and the Angels' duo of Jered Weaver ($85 million) and C.J. Wilson ($77.5 million).
"Both sides always felt they were pushing in the right direction," Cain said.
According to the AP, Cain can earn an additional $500,000 for winning the Cy Young award, $250,000 for second place, $100,000 for third, $75,000 for fourth and $50,000 for fifth. He would receive $1 million for a second or subsequent Cy Young. He also would get $250,000 for MVP, $150,000 if second, $100,000 for third, $75,000 for fourth and $50,000 for fifth.
Cain gets $200,000 if named World Series MVP and $150,000 if chosen NL Championship Series MVP, plus $100,000 for being selected an All-Star. He also could make $50,000 for a Gold Glove or Silver Slugger award.
The Giants said their talks with Cain's representatives were professional and constant in hopes of coming to an agreement before the Giants open the season Friday at Arizona. Sabean said the framework was in place, but finalizing details on the years and dollar figures happened over the final 72 hours.
"They're totally committed and they're all in on getting back to the World Series," manager Bruce Bochy said of the front office. "It's not easy to keep a pitching staff intact. That's a lot of money. We want to win. That's the message that is being sent and we're doing all we can to get back and hopefully have a year like we had a couple years ago.
"That's our strength. In this division it's all about pitching in these ballparks. That's how we're going to win."
One of the big beneficiaries of Cain's deal could be Philadelphia's Cole Hamels, currently the top pitcher eligible for free agency after this season. Cain's contract also could give Lincecum momentum when potential talks begin about a long-term contract beyond his latest contract.
In addition, San Francisco catcher Buster Posey could do well down the road. He also is represented by CAA. Posey, the 2010 NL Rookie of the Year who is coming back from an injury-shortened season last year, is thrilled to see Cain stay.
"It's extremely exciting to know that Cainer is going to be around for another six years," Posey said. "It makes you feel good. He's such a huge part of what we do every day with his work ethic. The days he's not pitching he comes in and is working so hard. That stuff really rubs off on the rest of the guys."
The Giants weren't wary of making a significant financial commitment to Cain considering the $126 million, seven-year contract they gave struggling left-hander Barry Zito before the 2007 season.
"We're particularly pleased with this agreement because Matt's a homegrown player," Baer said. "He's a cornerstone of our pitching staff. Matt's a Giant in every way. He personifies what we want in this franchise."
Cain appreciates the Giants' commitment to keeping the pitchers in place on a roster ready to make another October run after missing the playoffs last season.
"It's something very rare that you see a lot of guys come through the same organization," Cain said. "It's been kind of cool we've been able to push each other. We like that and we've known each other for so long. It's nice Brian and Larry want to keep those guys together. There's a lot of chemistry that comes along with that."
Information from The Associated Press was used in this report.