The Giants claimed their rubber match against the Red Sox after walking off with a 4-3 victory in 11 innings at Oracle Park.
Joc Pederson drove in the game-winning run in the bottom of the 11th with an RBI single.
Tristan Beck was credited with the victory after striking out three batters over two innings of relief.
San Francisco is now second in the NL West at 58-and-48.
Mauricio Llovera was charged with the loss after allowing the game-winning run.
Adam Duvall and Justin Turner each went deep in defeat.
Boston is now fourth in the AL East at 56-and-49.
They play in Seattle tonight.
(Photo by Kavin Mistry/Getty Images)