The deal is pending a physical, which had yet to be scheduled. Lincecum has a full no-trade clause in the new deal.
General manager Brian Sabean said when the season ended that among his top priorities was bringing back the two-time NL Cy Young Award winner, who also indicated he cherishes familiarity and wanted to stay with the only club he has known. He pitched the Game 5 clincher in the 2010 World Series against Texas, then shifted to the bullpen and became a reliable reliever during the Giants' 2012 run to their second title in three years. He pitched a no-hitter July 13 at San Diego.
Sabean wanted to lock up Lincecum's deal before he hit the open market in free agency.
The 29-year-old Lincecum just completed a $40.5 million, two-year contract that paid him $22 million this past season.
The Giants, who missed the playoffs at 76-86, already took care of their first order of business by signing right fielder Hunter Pence to a $90 million, five-year contract before the season ended. He played every game this year.
Lincecum, the 10th overall draft pick in 2006 out of Washington, has had losing records in each of the past three seasons, but manager Bruce Bochy has expressed encouragement with the pitcher's progress to make changes not only to his delivery and mechanics but also his between-starts routine and fitness.
After his final start of the season, Sept. 26 against the rival Los Angeles Dodgers, the four-time All-Star reflected on the idea of a possible departure. Many thought he might listen to his hometown Seattle Mariners if they came calling.
The Giants didn't let that happen, knowing someone would sign Lincecum in a hurry despite all the ups and downs.
"I've just been one of the most fortunate pitchers in this organization just to be a part of so many things," said Lincecum, who won the Cy Young in 2008 and '09. "To have the guys around me, Barry Bonds, Randy Johnson, big names, Buster Posey coming up, Pablo Sandoval. The names just don't end. To be here to witness all the things they've done, and be there for the team things, it's been pretty special for me."
Lincecum went 10-14 with a 4.37 ERA and 193 strikeouts in 32 starts this season. The right-hander joined Hall of Famers Juan Marichal and Gaylord Perry and also Kirk Rueter as the only Giants in San Francisco history to win at least 10 games in six straight seasons.
Nicknamed The Freak, Lincecum is 89-70 with a 3.46 ERA over seven major league seasons.
With fans unsure whether he would return beyond 2013, his supporters held signs during his last start such as, "Timmy Don't Leave" and "SF Loves You!" He tipped his cap -- a rare gesture for him.
"It was pretty special," Lincecum said at the time. "Just to be in that kind of situation today, you kind of really see what's going on and the emotions that are tied with it. I'm still trying to figure out how to handle it."