Jeff Skinner and Dylan Cozens scored for the Sabres (32-26-4), who have lost three of four. Craig Anderson made 34 saves.
Buffalo remained three points behind the Pittsburgh Penguins for the second wild card into the Stanley Cup Playoffs from the Eastern Conference.
"We had lots of looks," Sabres coach Don Granato said. "We missed the net quite a few times, too, on some point-blank chances that now, after the fact, it's very frustrating, because that turned out to be the difference in the game. We generated more than enough to win that game."
McDavid gave the Oilers a 1-0 lead at 7:21 of the first period, scoring on a wraparound after Ryan McLeod's initial shot hit off the end boards.
Skinner tied it 1-1 with a power-play goal at 9:45, one-timing a cross-ice pass from Tage Thompson in the right face-off circle.
"As a team, we were confident, we were ready to play today," Buffalo forward Casey Mittelstadt said. "I feel like the boys were loose and ready to go before the game. I was happy with our start. … We had a ton of chances in the first. Honestly, it was one of those games where we had so many chances, we were just waiting for them to go in. It just didn't happen tonight."
Ryan Nugent-Hopkins appeared to put the Oilers ahead at 5:32 of the second period, but the Sabres challenged the play for offside, and the call was reversed after a video review.
However, Ryan did give Edmonton a 2-1 lead at 18:45 when he scored through traffic from the slot.
Cozens scored 41 seconds into the third period to tie it 2-2, settling a bouncing puck before spinning and beating Skinner short side from the left circle.
"I think the [defenseman] got back and kind of forced me to do that (spin) if I wanted to get a shot off, and I just tried to put it on net and it found its way in," Cozens said.