ORCHARD PARK, N.Y. (AP) -- NFL quarterbacks who turn over the ball six times usually disappear quickly.

Tony Romo isn't going anywhere.

The unflappable Romo overcame five interceptions and a lost fumble to lead two last-minute drives, and rookie Nick Folk kicked a 53-yard field goal as time expired, giving the Dallas Cowboys an improbable 25-24 victory over the Buffalo Bills on Monday night.

Two of Romo's picks were returned for touchdowns in the first half, while his bobble and his fifth interception came during the fourth quarter.

Yet Dallas (5-0) won, setting up a megamatchup with the unbeaten New England Patriots on Sunday at Texas Stadium.

"That's a sign of a pretty resilient team," Romo said. "I think our team, outside of me, played an outstanding football game. They dug me out of it. It was tough to go through that, especially on Monday night.

"No one is going to care when it's all said and done how you won the game."

The Cowboys scored nine points in the final 20 seconds. Romo drove Dallas 80 yards and hit Patrick Crayton with a 4-yard TD pass with 20 seconds remaining. The 2-point conversion try failed when Jabari Greer stripped Terrell Owens of the ball in the end zone.

But Tony Curtis recovered the onside kick and after two completions, Folk nailed his fourth field goal, shocking the sellout crowd that came to celebrate the first Monday night home game for Buffalo (1-4) in 13 years.

"Oh, it's great," Folk said. "It shows you how good we can be and what we can do if we don't make mistakes. And even if we do make mistakes and we stick together as a team, we still stay in the game."

It was the second last-second loss on a field goal this season for the Bills; Denver did almost the same thing in the opener.

"It was embarrassing, embarrassing," Bills receiver Lee Evans, on the verge of tears, kept repeating in the somber locker room. "We had opportunities to put the game away, put some points on the board, give us a little more cushion. Couldn't do it. It's embarrassing."

This latest victory was one of the most implausible in the Cowboys' illustrious history. Buffalo made nearly all the key plays, including interceptions for TDs by George Wilson and Chris Kelsay and a 103-yard kickoff runback by Terrence McGee.

"We made too many big plays to lose that game," McGee said. "It just seemed we had it won. We were one play short."

In position to clinch it, Trent Edwards' pass from the Dallas 11 was tipped by DeMarcus Ware and returned 70 yards by Terence Newman. Romo looked for tight end Jason Witten, his favorite receiver. Instead, he found linebacker John DiGiorgio at the goal line and DiGiorgio returned his first career pickoff 38 yards.

It was the third time a pass intended for Witten was stolen by Buffalo.

Yet the Cowboys didn't fold. And after their long drive to Crayton's touchdown, Sam Hurd deflected the onside kick ahead to Curtis.

Immediately, Romo hit Owens, but he couldn't hold onto a 20-yard pass to the Buffalo 25; officials needed a replay review to overturn the original call.

Romo completed two more passes and Folk, after having his first try from 53 yards negated by a Bills timeout, won it.

"I haven't been around anything like that, and that's 31 years I've been in the league," Cowboys coach Wade Phillips said of his triumphant return to Buffalo, where he was 29-19 from 1998-2000.

Folk also made field goals of 47, 29 and 37 yards.

"I felt good. I helped the team win," he said. "I could care less if I kicked zero more field goals the rest of the year."

Buffalo built its lead on those huge plays.

Wilson spent most of last season on the practice squad before being converted to safety this year. He started in the injury-depleted secondary and his first NFL touch came when Romo badly overthrew Witten from the end zone. Wilson scooted in untouched for a 25-yard score.

And when Romo went for Witten on his next pass attempt, Angelo Crowell intercepted.

But Dallas held, stopping Marshawn Lynch's fourth-and-1 run. Then Romo recovered nicely, throwing three straight completions to Witten and a 14-yarder to Owens before completing a 70-yard drive with a floater to the tight end for a 22-yard score early in the second period.

It was a temporary reprieve. After Buffalo staged a superb 15-play, 73-yard drive to Rian Lindell's 24-yard field goal, Kelsay made his spectacular solo effort to give Buffalo a 17-7 lead. The defensive end deflected Romo's pass high into the air at the Dallas 2, then caught it in the end zone.

"Turnovers, kick return for a touchdown, those are things that win ballgames," Kelsay said.

Moments later, Romo threw a weak sidearm pass that Greer picked off at the Dallas 43. The four first-half picks were one more than the total that Romo had thrown in the previous four games.

The Bills didn't capitalize, with Lindell missing a 54-yard field goal with 36 seconds to go in the half. That was enough time for the good Romo to emerge, and a 22-yard pass to Hurd set up Folk's 47-yarder to close the half at 17-10.

Folk made a 29-yarder on the first drive of the third quarter, then McGee got his fifth career kickoff return TD, bursting untouched down the middle of the field.

But just like in the early 1990s, when the great Bills teams that made four straight Super Bowls twice lost to Dallas in the title game, this one also would go the Cowboys' way.

Incredibly.

Game notes

The last time Buffalo had two interception touchdowns in the first half was 15 years ago against Indianapolis ... Romo finished 29-for-50 for 309 yards. Witten had nine catches for 103 yards ... Thurman Thomas, one of the heroes of the great Bills teams of the early '90s that went to four straight Super Bowls, received his Hall of Fame ring at halftime ... Lindell scored six points, giving him 424 with the Bills to pass O.J. Simpson (420 points) for fifth on the team list.