The Baltimore Ravens got the kind of treatment they usually dish out.

Joe Flacco was sacked five times and threw two interceptions, and the Ravens' normally ferocious defense was anything but as playoff-bound Baltimore was roughed up 34-14 on Sunday night by the desperate San Diego Chargers.

"Anytime you lose a game, you're not happy about it," Flacco said. "I think you're more disappointed really when you do shoot yourself in the foot and you feel like you could have done something about it. It was just bad."

Philip Rivers threw for one score and reached the 4,000-yard mark for the fourth straight season, and Ryan Mathews ran for two scores and hit 1,000 yards rushing.

The Chargers (7-7) won their third straight following a six-game losing streak and are tied with Oakland for second in the AFC West, a game behind Denver with two to play. Denver and Oakland both lost on Sunday. The Chargers finish with road games against Detroit and the Raiders.

The Ravens (10-4) had their four-game winning streak snapped, but clinched a playoff berth earlier in the day thanks to losses by the New York Jets, Oakland and Tennessee.

"It was an ugly one," Flacco said. "Things weren't going our way. They were playing well and we weren't. You've got to move on."

Even though Ray Lewis was back with the Ravens after a four-game injury layoff, the Ravens only had two punishing hits on Rivers. Rivers was dominating, completing 17 of 23 passes for 270 yards to lead the Chargers to scores on six of their first seven possessions. He didn't throw an interception and the only sack the Ravens got was wiped out on a personal foul against Terrell Suggs.

Rivers joined Peyton Manning (1999-04 and 2006-10) and former teammate Drew Brees (2006-11) as the only QBs in NFL history with at least four-straight 4,000-yard seasons.

Flacco got the treatment many thought Rivers would. Flacco was sacked five times — three by former Ravens linebacker Antwan Barnes — and intercepted twice. Overall, the Chargers had seven sacks and Barnes finished with four.

Mathews scored on runs of 1 and 3 yards.

Rivers surpassed 4,000 yards on a 21-yard completion to Malcom Floyd that set up Mathews' 3-yard TD run late in the third quarter. The drive was set up when Takeo Spikes intercepted Flacco and returned it 45 yards to the Baltimore 27. The Chargers were flagged 15 yards for excessive celebration.

Nick Novak, who earlier kicked a 45-yard field goal for the Chargers, had a 37-yard attempt bounce off the right upright late in the third quarter.

San Diego took the second-half kickoff and moved 80 yards, with Rivers throwing a perfect 28-yard TD pass to Floyd for a 24-7 lead.

"When you give a team momentum when they're home, that's how they drive," Lewis said. "That's why we're so dominant at home. And San Diego is the same way. When you give the home team momentum, this is what happens."

Mathews scored on a 1-yard run and Novak kicked a 45-yard field goal to help the Chargers take a 17-7 halftime lead.

Novak became the first Chargers kicker with 11 field goals of 40 yards or longer in a season when he booted his 45-yarder for a 10-7 lead. Rivers was sacked on the drive by Cory Redding for an 8-yard loss, but Suggs was whistled for a personal foul for head-slapping tight end Randy McMichael.

Instead of a third-and-17 on their 27, the Chargers had a first down on the 50 after the 15-yard penalty.

After forcing a Ravens punt, the Chargers moved 80 yards in seven plays. Rivers pitched to Mathews for a 1-yard TD run and a 17-7 lead. The key play was Vincent Jackson's 58-yard reception, which put him over 1,000 yards for the season.

San Diego's Mike Tolbert scored on a 2-yard run on San Diego's opening drive and Flacco's 15-yard touchdown pass to Ed Dickson tied it early in the second quarter.