Paul Gaustad scored midway through the third period to help the Buffalo Sabres avoid a second-half meltdown in a 5-3 victory over the Toronto Maple Leafs on Friday night.

Ryan Miller stopped 33 shots, including the first 16 he faced, to earn his 30th win of the season in his first game back after missing 13 because of a sprained left ankle.

Tim Connolly scored twice, Jochen Hecht had a goal an assist and Daniel Paille also scored for a Buffalo team that nearly squandered a 4-0 lead.

The win set up a key Eastern Conference playoff showdown Saturday, when Buffalo travels to face Montreal. With 80 points and eight games left, the Sabres are 10th place in the East, five points behind Montreal, which holds the eighth and final playoff spot.

Gaustad's goal was key, scored with 9:04 left, and coming less than 3 minutes after Matt Stajan and Nikolai Kulemin scored 43 seconds apart to cut it to 4-3.

Jochen Hecht set up the goal by driving up the right wing and getting off a hard shot that rookie backup goalie Justin Pogge stopped, but lost the puck underneath his equipment, creating a scramble in the crease. The puck eventually squirted loose into the slot, where Toronto defender Ian White's clearing attempt struck Gaustad and caromed into the open net.

Stajan and Boyd Devereaux had a goal and assist each for the 11th-place Maple Leafs, who lost for only the second time in six games (4-2-0) and are all but mathematically eliminated from contention.

Miller had little support on the three goals he allowed _ including Kulemin's which came during a scramble in front and after Miller made a diving stop to foil Alexei Ponikarovsky.

Miller, othwerwise, showed little signs of rust or effects of the injury, and was particularly sharp in the first period, when he made 14 saves, including two on bang-bang chances by Stajan from the right circle.

The same could not be said for the goaltending at the Toronto end. Veteran Curtis Joseph had a tough outing. He allowed four goals on nine shots and was yanked 3:30 into the second period after Paille and Connolly scored 21 seconds apart.

Joseph earned his 351st career loss to move to within one of matching Gump Worsley's NHL record.

Notes:@ Joseph is tied for second in career losses with Gilles Meloche, but also ranks fourth with 453 career wins. ... Sabres D Craig Rivet left 3 minutes into the third period after being struck in the right cheek by Devereaux's weak shot from the high slot. ... Leafs RW Niklas Hagman missed his 13th game with a concussion, but has a chance to return as soon as Saturday, when Toronto hosts Boston. ... Joseph started in place of Martin Gerber, who received an automatic three-game suspension from the NHL for abusing referee Mike Leggo in a 3-2 shootout win over Washington on Tuesday night.

Copyright 2009 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.