Brayden Point also had two goals, Brandon Hagel had a goal and an assist, and Corey Perry also scored for the Lightning, who rallied from two goals down in the third period to force overtime. Nikita Kucherov and Mikhail Sergachev each had three assists, and Stamkos added one for a three-point night.
Brian Elliott had 32 saves to get the win.
''We got the breaks at the end to pull us back, some big-time players got us back into it,'' Tampa Bay coach Jon Cooper said.
Tage Thompson had a goal and an assist, and Tyson Jost, Jeff Skinner, Jack Quinn and Dylan Cozens also scored for Buffalo. Ukko-Pekka Luukkonen made 19 saves.
''You allow good players a little bit of extra time and a little bit of extra space, they're going to make plays on you,'' Sabres coach Don Granato said. ''We had hesitation in our game and it was only the last 10 minutes.''
In the extra period, Stamkos got the winner on a blast from the right circle for his 12th of the season.
''There's going to be games where we don't deserve the two points and tonight was probably one of those, but we've been on the other side of that too,'' Stamkos said.
With the score tied at 3-3 to open the third period, the Sabres appeared to take control in the third with two goals for a 5-3 lead with a little more than 5 1/2 minutes remaining.
Cozens put Buffalo ahead at 9:37, ripping a shot from the right circle under the crossbar and beating Elliott on the glove side. Skinner made it 5-3 with 5:41 remaining, finishing from a tight angle after an odd-man rush was initially stopped.
However, the Lightning answered back with two goals 3 1/2 minutes apart.
Stamkos scored just 16 seconds after Skinner's goal to get the Lightning within one. Hagel tied it with a power-play goal with 2:02 remaining. With Elliott pulled to create a 6-on-4 advantage, Kucherov's shot from the right circle was deflected by Hagel past Luukkonen.
Point opened the scoring 7:54 into the game with a power-play goal from close range for his ninth.
Perry made it 2-0 with 3:12 left in the first off a cross-ice pass from Stamkos.
Thompson put Buffalo on the board with 2:06 left in the first, beating Elliott with some nifty stick-handling after forcing a turnover in front of the Tampa net.
Quinn evened it 59 seconds later, finishing a nice feed from JJ Peterka on a quick offensive rush.
Jost gave Buffalo a 3-2 lead midway through the second period, scoring his first goal with the Sabres after he was acquired off waivers from Minnesota on Nov. 19.
Point tied it 3-3 on the power play with 3:34 left in the second after getting a pass from Kucherov.
Each team had one player return from a recent injury. Sabres center Rasmus Asplund returned after missing two games with an upper-body injury. Tampa Bay forward Cole Koepke returned after missing three games with an upper-body injury.
Lightning: At Boston on Tuesday night.
Sabres: At Detroit on Wednesday night.
AP NHL: https://apnews.com/hub/nhl and https://twitter.com/AP-Sports
Copyright 2023 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.