"That wasn't our best game, but we came out with a huge win," Raymond said.
Dylan Larkin and Patrick Kane also scored, and Alex Lyon made 37 saves for Detroit (38-31-8), which was 1-3-2 in its previous six games.
The Red Wings led 3-0 just eight minutes into the game.
"Finding a way to close out games like that is difficult, especially against a team like that," Red Wings coach Derek Lalonde said. "I thought [Lyon] was our best player in the third period (17 saves). That team had some really good looks that he kept out of the net."
The Red Wings moved into the second wild card into the Stanley Cup Playoffs from the Eastern Conference, one point ahead of the Pittsburgh Penguins, Washington Capitals and Philadelphia Flyers.
Tage Thompson scored for Buffalo (37-36-5), which had won two in a row. Ukko-Pekka Luukkonen made 21 saves.
"You see a lot of games where you put that many pucks on the net and a bunch bounce in for you," Sabres coach Don Granato said. "There were a lot of pucks that the goaltender never saw and hit him. We had chances, but we needed one to go in."
Buffalo is five points behind Detroit for the second wild card and has played one more game. The Sabres have won more than two games in a row just twice this season.
"If you can't win more than three games in a row, you probably aren't going to make the playoffs," Buffalo forward Alex Tuch said.
Raymond gave the Red Wings a 1-0 lead 53 seconds into the game, beating Luukkonen from the high slot.
"We've struggled with our starts the last couple weeks," Raymond said. "That makes it even better to come out and get the kind of start we did."