JACKSONVILLE, Fla. - The San Diego Chargers sure know how to end a six-game losing streak.

Just travel 2,000 miles to Jacksonville. It's worked twice in the last five years.

Philip Rivers threw four touchdown passes, two to Antonio Gates, and the Chargers beat the Jaguars 31-25 on Sunday for their first victory in nearly two months.

Rivers and the Chargers (3-8) also ended a six-game skid in the River City in 2011.

"This was long overdue," Rivers said. "It feels good. We leaned on each other a lot today. By no means does 3-8 sound wonderful, but winning today sure does."

Rivers passed Joe Montana (273) and tied Vinny Testaverde (275) for 11th on the NFL's all-time passing touchdown list. He also became 17th in NFL history to throw for 40,000 yards.

"You think about all the guys that protected you over the years, all the guys that made catches," Rivers said. "It's definitely a collective kind of milestone. Every pass has to go to someone who has a hand in making it a completion. It's a lot of yards. I'm just glad that I've been able to be out there for 155 games in a row to reach something like that."

Rivers completed 29 of 43 passes for 300 yards. He was sacked twice and had his left ankle checked in the locker room at halftime. But his four TDs were enough against the Jaguars (4-7), who failed to recover an onside kick in the closing minutes.

Jacksonville also had more red-zone troubles, scoring just once in four trips inside the 20-yard line.

Two of those drives ended with field goals after Blake Bortles scrambled on third down and threw passes beyond the line of scrimmage.

"That's kind of stupid," Bortles said. "I don't know from a coach's perspective what you tell a guy that does that, 'Quit being an idiot?' I don't know. I've never done that in my life, and I did it twice today.

"It's not really something you ever talk about with a coach. It's kind of a given. From the time you start playing football, you can't throw the ball forward past the line of scrimmage. Bad plays, tough ones to live with."

The Chargers (3-8), meanwhile, found the end zone on all three red-zone possessions in the first half. Rivers hooked up with Dontrelle Inman from 2 yards out and then found Gates for a 9-yard score that put San Diego ahead 14-9.

Bortles threw his 13th interception of the season on the ensuing possession, and Rivers and Gates connected for a 12-yard score and a double-digit lead three plays later.

The Chargers made it hold — thanks to Rivers' fourth TD pass, which followed Bortles' 21-yard strike to Julius Thomas with about 11 minutes to play.

"How about No. 17?" San Diego coach Mike McCoy said of Rivers. "He's amazing. When you prepare the way he does and you get us in the end zone the way he does, give him so much credit. He's just remarkable."

Rivers had some help. Johnson caught seven passes for 92 yards. Inman had five receptions for 65 yards. Gates hauled in four for 53 yards.

The Jaguars blocked a punt and scored with 1:21 remaining to make it close, but Jason Myers' onside kick was batted out of bounds.

With Houston and Indianapolis both winning, the Jags lost ground in the muddled AFC South.

Bortles completed 30 of 49 passes for 329 yards, with two touchdowns and an interception.

Thomas caught nine passes for 116 yards. Allen Robinson finished with 56 yards receiving and a score.

Fellow Jaguars receiver Allen Hurns left the field on a stretcher with 3:44 remaining and was later ruled out with a concussion. The team said Hurns had movement and feeling before being transported to a local hospital as a precaution. He was later released.

"I hate to see that happen to one of my teammates, especially to a guy that's been having a hell of a season," Thomas said. "Our prayers are with him. I hope he's OK."

Notes: Chargers have won five in a row in the series. ... Rivers now has 40,166 yards passing. ... Jaguars FS Josh Evans left the game with a concussion and did not return. ... Hurns has played in 27 consecutive games since making the team as an undrafted free agent from Miami.

___

AP NFL website: www.pro32.ap.org and www.twitter.com/AP_NFL