BUFFALO, N.Y. – Drew Stafford’s hat trick provided all the offense the Buffalo Sabres needed.

Stafford scored three goals for his third hat trick, and the Sabres beat the Boston Bruins 3-2 on Wednesday night.

It was the second time this month that Stafford came back from an injury and was a big part of a Sabres win. He missed 11 games because of a shoulder injury sustained on Nov. 5 against Montreal before netting a goal and assist in a win against Columbus on Dec. 3.

He aggravated the injury in that game and sat out the next four games. Upon his return Wednesday, Stafford helped the Sabres snap a three-game losing streak to their division rival.

“I think I’m going to take another two weeks off and come back and get a couple points and hopefully win,” joked Stafford, whose two other hat tricks came in blowout Buffalo victories. “You’re hungry to get back. Unfortunately I got hurt, but I’m hoping those days are behind me and I can finish out the rest of the year healthy.”

Stafford completed his hat trick with 9:05 left to give the Sabres a 3-2 lead. In the left circle, he swatted in Roy’s pass from the slot on the power play.

“He’s a skilled player that you’re hoping to get offense from,” Sabres Coach Lindy Ruff said. “It gives us that extra dimension. He’s strong, and has a great shot. I said coming out of training camp I think he was our best player.”

Stafford wasn’t the only one to return. Tim Connolly (groin) and Rob Niedermayer (knee surgery) both came back after missing eight games.

Derek Roy assisted on all of Stafford’s goals, and Ryan Miller made 32 saves for the Sabres, who rebounded from a 5-2 loss to Pittsburgh on Saturday.

“We know we’re a good team and we can win games,” said Miller, who made his eighth consecutive start after missing two because of groin soreness. “It’s up to us to stay patient. I thought we had a great presence.”

Miller is 5-2-1 since rejoining the lineup.

David Krejci and Michael Ryder scored, and backup goalie Tuukka Rask finished with 32 saves for Boston, which has lost two straight.

“We knew they were going to play us hard,” Ryder said. “It was a grind right until the end.”

Rask made his second start in seven games in relief of Tim Thomas, who will likely start on Thursday at Montreal.

The Sabres scored twice on the power play against the NHL’s third-ranked penalty-killing unit.

“Our penalty kill has got to be better,” Boston Coach Claude Julien said. “It was not on top of its game. We gave them the shots and the looks they wanted, and we didn’t react very well.”

Ryder gave the Bruins a short-lived 2-1 advantage with his ninth of the season on the power play at 6:21 of the third. After picking up the puck in the neutral zone, he split Steve Montador and Jochen Hecht, deked Miller, and slid in a shot.

But Stafford tied it 32 seconds later with his second of the game. Krejci opened the scoring with his fifth of the season with 2:31 left in the first period.

Stafford tied it with a power-play goal with 79 seconds remaining in the first.