Cody Hodgson scored the decisive goal in the fourth round of the shootout to snap Buffalo's four-game losing streak.
Hodgson put on a series of back-and-forth moves before slamming on the brakes and snapping the puck past Antti Niemi for the eventual game winner.
Niemi finished the game with 35 saves. Buffalo's Ryan Miller finished with 47 saves.
Tyler Ennis and Drew Stafford scored a goal and assist apiece for the Sabres. Tommy Wingels and Tyler Kennedy also scored goals.
Ennis scored a power-play goal at 1:20 of the third period staked Buffalo to a 3-1 lead, but San Jose roared back with three goals in the period, including Wingels' tip-in at 16:14 to forge a 4-4 tie and send the game into overtime.
Duggar sisters unveil Christian dating rules in new book
Astronomers offer more expansive view of universe