FOXBOROUGH — If the Patriots were a teenage driver, you wouldn’t let them borrow your car after dark. If they were a money manager, you would make small investments with them (but nothing risky). If they were a doctor, you would accept their treatment plan, but make sure you sought a second opinion.

The Patriots want to be dependable, consistent, responsible, and reliable, but nine games into a mystifying season, the team built on “In Bill We Trust” isn’t trustworthy. Exhibit A of their capricious play was Sunday’s 37-31 victory over the Buffalo Bills at Gillette Stadium, a game that had more ups and downs than a freight elevator.

The Patriots never trailed, but they were never able to get comfortable either until Harvard’s Ryan Fitzpatrick was intercepted by Devin McCourty in the end zone with 23 seconds left, the last of three turnovers generated by the Patriots.

“I’ll take any win. I’ll take any win,” said coach Bill Belichick, whose team has arrived at 6-3 unevenly.

That was a less-than-reassuring proclamation for a less-than-reassuring victory. Every time you think the progeny of Patriot Place have turned the corner it turns out they’re just circling the block. Even quarterback Tom Brady and nose tackle Vince Wilfork seemed agitated by the team’s inconsistency Sunday.

The win wasn’t pretty and neither were the defensive numbers afterward.

The Bills, who entered ranked 21st in the NFL in offense, rang up 31 points, 481 yards of offense, 35 first downs (a season high by a Patriots opponent), and 162 yards rushing (another season high allowed by the Patriots). Buffalo converted 64 percent of its third downs. It averaged 5.8 yards per rush. Fitzpatrick became the fifth quarterback this season to throw for more than 300 yards against the Patriots, finishing 27 of 40 for 337 yards and two touchdowns.

“We definitely have to make sure we tune those things right back up, but we made the plays when we needed to make them,” said Wilfork. “That’s the biggest thing. I’m very proud to go out with this defense and take the field at the end of the game and actually close the game out. That was a big statement. We did it against the Jets. We did it against Buffalo. That just shows me a defense that is growing, and a lot of guys that believe in one another.

“We just have to be more consistent with it. As long as we’re more consistent we’ll play better, but when we have those inconsistencies we’ll always have problems. But we’re working. We’ll continue to get better.”

This game came down to the natural order in the NFL. The Patriots are the Patriots because they find a way to win games like Sunday’s. The Bills are the woebegone outfit they are because they find a way to lose them. Buffalo hasn’t won in Foxborough since 2000. The Bills are Wile E. Coyotes in cleats against the Patriots. Just wait for that Acme safe to drop on their heads.

The Patriots can beat the scuffling 3-6 Bills playing this way, but they’ll be hard-pressed to beat the Texans, the Steelers, or Ravens in such a manner in January.

Patriots wide receiver Deion Branch said it best — this was a weird game.

On their first possession, the Bills turned a third and 1 into a third and 21 with three consecutive penalties, a holding call sandwiched between two false starts.

That was fitting because this entire game felt like a false start to the second half for the Patriots.

Buffalo must have felt like it had come to play a football game and an NBA contest broke out. They were whistled for 14 penalties for 148 yards, 10 of which for 119 yards came in the first half, when the hosts built a 24-17 lead. New England finished with seven penalties for 73 yards.

The Patriots went up, 24-10, with 3:54 left in the first half thanks to a pair of pass-interference penalties that totaled 54 of the 82 yards on their scoring drive. The latter of the flags was a dubious 37-yarder on corner Stephon Gilmore that gave the Patriots first and goal at the 1. The ball was catchable — if Brandon Lloyd was in Providence. Two pass-interference calls also set up the Patriots’ first TD.

Two plays later, Brady (23 of 38 for 237 yards and two touchdowns) tossed a 2-yard TD pass to Rob Gronkowski.

It was Belichick’s red challenge flag that loomed large in the fourth. With the Patriots leading by 10, Fred Jackson was stripped by McCourty at the end of a 12-yard run at the Patriots’ 1, with Kyle Arrington recovering. The play was initially ruled down by contact, but Belichick challenged and it was overturned.

The Patriots’ lead was cut to 34-31 with 7:47 to go.

But the New England offense, oft-maligned for failing to close out games, engaged in a 14-play, 59-yard drive that took 5 minutes 41 seconds off the clock. It ended with Stephen Gostkowski’s third field goal of the day, which gave the Patriots a 37-31 lead with 2:06 to go.

The Patriots’ defense, and the gravitational pull of losing that weighs down the Bills’ franchise, took care of the rest.

“Devin made a big play,” said Wilfork. “Situational, we played very well. But it’s in between situations. We’ve got to just put it together for 60 minutes, just be consistent with it. If we do that, we’ll be OK, but I’m never disappointed in a win. I don’t care how we get it because that’s what this game is all about, winning and losing.”

If the 2012 Patriots had a slogan it would be “The win justifies the means.”