Tyrod Taylor's 16-yard touchdown pass to Justin Hunter with 10:46 remaining put the Bills ahead for good during a second half in which the teams traded the lead five times. Taylor also scored on a 7-yard run in helping to keep Buffalo in the playoff hunt.
The Bills (6-5) won for the second straight week when trailing at halftime after doing so just once last season.
Buffalo trailed the Jaguars 7-6 after two quarters on Sunday, and overcame a two-point deficit in a 16-12 win at Cincinnati last week.
Taylor also produced just the second fourth-quarter comeback of his career, and improved to 2-11 when the Bills trail by four or more at any point in a game.
The Jaguars (2-9) lost for the sixth straight game -- their longest skid since opening the 2014 season at 0-6.
The game was decided with four minutes left, when the Jaguars were unable to convert a fourth-and-9 at the Buffalo 46. Blake Bortles hit Marquise Lee on a crossing pattern over the middle, but he was limited to a 4-yard gain.
The Bills then took over and ran out the clock.
Bortles went 13 of 26 for 126 yards and two touchdowns, and also had a career-best 81 yards rushing.
The Jaguars' offense was hampered by injuries. Chris Ivory, who opened the scoring with a 2-yard run, was sidelined in the first half by a hamstring injury. And then Jacksonville lost receiver Allen Hurns, also with a hamstring injury while diving into the end zone on a 12-yard catch and run .
Hurns' touchdown put the Jaguars up 21-20 in the opening seconds of the fourth quarter.
The Bills responded with Taylor leading an eight-play, 76-yard drive which he capped with a perfectly placed pass to Hunter at the goal line. McCoy then dived across the goal line for the 2-point conversion.
McCoy finished with 103 yards rushing and showed few signs of being bothered a week after having surgery for a dislocated left thumb.
His two touchdowns came 33 seconds apart spanning halftime.
After scoring on a 7-yard run late in the second quarter, he opened the third quarter by scoring on Buffalo's first snap from scrimmage. Taking the handoff, McCoy burst off right tackle and blew past defensive backs Jalen Ramsey and Tashuan Gipson.
JAGS' BIG OPENING
The Jaguars snapped the NFL's longest active drought by scoring on their opening possession for the first time in 25 games. The streak began in Week 3 of the 2015 season, and featured the Jaguars combining for three field goals, punting 18 times and turning the ball over three times.
Ivory's touchdown capped an 11-play, 75-yard drive spanning 6:45. The Jaguars converted three third-down chances, including their last one courtesy of a defensive holding penalty against Corey White on third-and-goal from the 3.
Sammy Watkins had three catches for 80 yards -- including a 62-yard catch -- in playing his first game in nine weeks since aggravating an injury to his surgically repaired left foot.
Jaguars: Host Denver on Dec. 4.
Bills: At Oakland on Dec. 4.
For more NFL coverage:
AP NFL website: www.pro32.ap.org and www.twitter.com/AP-NFL
49ers fall to 8-1 as Seahawks squeak by with OT victory
Despite a spirited fourth-quarter comeback and a wild overtime period, the 49ers suffered their first loss of the season, a 27-24 overtime defeat at the hands of the Seahawks and quarterback Russell Wilson.
Wilson considers OT win one of the wildest he's ever played
Russell Wilson says the Seahawks' overtime victory to hand the 49ers their first loss could be the most wild game he's ever played in.
Seahawks knock 49ers from unbeaten ranks with 27-24 OT win
Jason Myers kicked a 42-yard field goal after Chase McLaughlin missed a kick earlier in overtime, and the Seattle Seahawks handed the San Francisco 49ers their first loss of the season with a 27-24 victory on Monday night.
Myers is money on game-winning FG in OT
Jason Myers' 42-yard field goal as the overtime clock expires squeaks through the upright to hand the 49ers their first loss.
McLaughlin shanks game-winning FG attempt in OT
Chase McLaughlin's game-winning, 47-yard attempt in overtime is wide left, giving the Seahawks the ball back with over two minutes remaining.
49ers rookie kicker drills FG, sends game to OT
Chase McLaughlin's game-tying, 47-yard field goal to tie the game splits the upright and sends the 49ers into overtime.