In a contest that lasted 5 hours, 54 minutes, featured 50 players overall and saw "Take Me Out to the Ballgame" played in the middle of the 14th inning, the Giants won 7-6 on a pinch-hit sacrifice fly by Alex Dickerson in the 15th.
Dereck Rodriguez (6-9), who worked two innings for the victory in Boston, was the record-tying 24th pitcher of the night -- and also the MLB-record-tying 13th pitcher used by the Giants.
"I wanted to get my 10,000 steps, and I was a little behind," Giants manager Bruce Bochy jokingly said of the pitching changes. "We had some guys that picked each other up. It was September baseball with added arms.
"You never like to use that many pitchers. Believe me."
San Francisco's pitchers threw 294 pitches to Boston's 253.
The marathon game put Bochy, who is retiring at the end of the season, one win away from becoming the 11th big league manager to reach 2,000 victories. All 10 managers in the 2,000-win club are enshrined in Cooperstown.
ESPN's Joon Lee and The Associated Press contributed to this report.