Anaheim led 2-0 before allowing four goals over the final 24 minutes.
"The discipline issue crept into our game tonight," Ducks coach Randy Carlyle said. "We took three straight penalties in a row and allowed them the momentum. Any time you do that in a hockey game, the other team senses an opportunity and they seized the opportunity."
The Sabres scored two goals 1:28 apart in the second period to tie the game 2-2, and Ristolainen's power-play goal at 3:57 of the third gave them a 3-2 lead. Berglund scored into an empty net at 19:43.
"When we are moving the puck quick and guys are moving back into position, we counter quickly," Housley said. "From that point, I think we had a shot mentality. Everything was going to the net and more guys were getting there and making it tough for Miller and we get rewarded."
Sherwood gave the Ducks a 2-0 lead at 13:32 of the second period, but center Ryan Getzlaf was called from tripping Sabres center Jack Eichel on the ensuing face-off.
"From that point on, they seemed to seize control of the game," Carlyle said.