Updated

By Steve Ginsburg

BALTIMORE (Reuters) - The Baltimore Ravens were taken to the brink by the Buffalo Bills but managed to edge the NFL's only winless team 37-34 in overtime on Sunday to remain one game behind front-running Pittsburgh in the AFC North.

Baltimore's Billy Cundiff booted a 38-yard field goal four minutes into the extra session for the sixth game-winning kick of his seven-year NFL career.

"We have to play better than that to be the team we want to be. But I'm proud of the win."

Cundiff's game-clincher came after Ravens 11-time Pro Bowl linebacker Ray Lewis stripped the ball from Buffalo tight end Shawn Nelson and recovered the fumble at the Bills 45.

"I saw the ball, snatched it out of his hand knowing he was trying to go forward and the whistle hadn't blown yet," said Lewis. "It just so happened he and I locked arms and I snatched it out."

An unnecessary roughness call against Buffalo after the play moved the ball to the Bills 29. After three plays netted nine yards, Cundiff was sent out for his game-ending heroics.

"To lose it the way we did, it definitely hurts," said Bills defensive end Marcus Stroud. "We'll just go back to the drawing board, once again. Same thing. I'm tired of saying it. And I know people are tired of hearing it."

The Bills (0-6) squandered a 14-point lead and needed a 50-yard field goal with four seconds left in regulation to send the game into overtime.

Although they shredded the NFL's third-ranked defense for 506 yards -- the most the Ravens have allowed since 2000 -- the Bills were badly hurt by turning the ball over four times.

"This is the NFL and they are not a bad team," running back Ray Rice, who led the Ravens ground game with 72 yards on 16 carries, said of the Bills. "Their record does not show how good they actually are. That team has a lot of talent."

Baltimore's pass defense took a beating from Bills quarterback Ryan Fitzpatrick, who completed 29 of 43 passes for 374 yards and four touchdowns, three of them to Lee Evans.

The Bills held a 14-point lead but allowed the Ravens to score 10 points in the final minute of the second quarter to take the steam out of their inspired first-half play.

Baltimore erased their 24-20 deficit 16 seconds into the third quarter when quarterback Joe Flacco found Anquan Boldin wide open on a flea flicker for a 34-yard scoring strike.

Flacco was less than his best but still managed to complete 16 of 31 passes for 250 yards and three touchdowns.

"Before we knew it some things started going our way a little bit. We were scoring touchdowns and getting ourselves back in the game."

(Editing by Frank Pingue)