The Giants have acquired Jake Peavy from the Red Sox, CBS Sports’ Jon Heyman tweets. The Red Sox will receive pitching prospects Edwin Escobar and Heath Hembree, ESPN’s Buster Olney tweets. The Giants will pay $2MM of what’s left on Peavy’s contract, ESPN’s Jim Bowden tweets.

The trade reunites Peavy with Bruce Bochy, who managed him with the Padres. The deal also provides the Giants with valuable starting pitching depth, which they needed, given Matt Cain’s injury. The Red Sox, meanwhile, add prospect depth while clearing space for younger starting pitchers like Brandon Workman and Allen Webster.

Peavy is making $14.5MM in his final season before free agency. (His contract indicates that he can receive a player option for 2015, but he will not be able to pitch enough innings to attain it.) In 124 innings this season, has a 4.72 ERA with 7.3 K/9 and 3.3 BB/9.

Escobar and Hembree appear to constitute a strong return for Boston. The lefty Escobar, 22, has pitched the entire season with Triple-A Fresno, posting a 5.11 ERA with 7.8 K/9 and 3.0 BB/9. He had a very strong 2013 season at Class A+ and Double-A. MLB.com ranked him the Giants’ No. 2 prospect and the No. 75 prospect in all of baseball, noting that he could become a middle-of-the-rotation starter.

Hembree, 25, has spent most of the 2014 season with Fresno, where he’s posted a 3.89 ERA with 10.5 K/9 and 3.0 BB/9 in 39 1/3 innings of relief. He appeared in nine games in the big leagues in 2013. MLB.com ranked him the 11th-best prospect in the Giants’ system, noting that he has long been regarded as a potential closer. Both Escobar and Hembree were on the Giants’ 40-man roster, although the Red Sox had a 40-man spot open before the trade, so they didn’t need to make any further moves to add both.

Heyman tweeted that the Red Sox would acquire minor league pitchers in return, with WEEI.com’s Alex Speier tweeting that the Red Sox would get one righty and one lefty. Jen Royle of the Boston Herald tweeted this morning that Boston was close to trading Peavy to an NL team, and FOX Sports’ Ken Rosenthal tweeted that the Red Sox and Giants were in serious discussions. CSNBayArea.com’s Andrew Baggarly reported that the Giants would receive cash in the deal.

Photo courtesy of USA Today Sports Images.