The 2007 NL Cy Young Award winner will start Sunday night's series finale against the Los Angeles Dodgers. The Giants held a half-game division lead in the NL West against their rival going into Saturday night's middle game at AT&T Park.
The Giants have plenty of familiarity with Peavy, who pitched for manager Bruce Bochy with the San Diego Padres in the playoffs in 2005-06.
"It's great to be reunited with Jake," Bochy said by text message. "Look forward to working with him again."
San Francisco missed the playoffs in 2013 after winning the World Series in 2010 and '12, and the club is committed to making another special October run.
The 33-year-old Peavy pitched one of his best games last Aug. 25 at Dodger Stadium. He tossed a three-hitter with five strikeouts and one walk in an 8-1 Red Sox victory.
San Francisco received cash from Boston and is sending right-hander Heath Hembree and lefty Edwin Escobar to the World Series champion Red Sox in the swap. Both players were optioned by the Red Sox to Triple-A Pawtucket.
"It provides Jake an opportunity to step right into a more ready pennant race out in the west," Boston manager John Farrell said. "And we get two pitchers back we like."
Peavy (1-9, 4.72 ERA) has been hurt by poor run support this season, receiving two runs or fewer of support in each of his past eight starts. He is in the final season of a $29 million, two-year contract.
"Going to miss him," Boston's Mike Napoli said. "A great competitor. A great teammate. His record doesn't really show the kind of pitcher he is."
Peavy is earning $14.5 million this season, with the Red Sox paying more than $3 million of his remaining salary for the year -- $5.15 million.
Six weeks on the disabled list last year with a rib injury cost him a chance to have a conditional $15 million option for 2015 if he had reached 400 innings over 2013-14. He is at 268 2-3 heading into Sunday's outing.