BALTIMORE -- Somehow the Yankees have managed what was unthinkable only two or three days ago: They have inserted possible final-day drama into their chase to host Tuesday night's wild-card game.

They entered the weekend with a magic number of one to secure home-field advantage for that game. But that number held steady after Houston beat Arizona, 21-5, on Friday night and the Yankees dropped a doubleheader to the Orioles Saturday -- 9-2 in Game 1 and 4-3 in Game 2 at a damp and chilly Camden Yards.

That cut the Yankees' lead over the Astros to 11/2 games entering the Houston-Arizona game Saturday night. A win by the Astros (85-75) -- who led 6-1 in the eighth inning -- would have moved them within one game of both the Yankees (87-74) and AL West-leading Rangers (87-74) entering the final day of the regular season. A Houston loss would have clinched home-field advantage for the Yankees.

In the event that the Astros won last night, Joe Girardi said he would use his full lineup today after fielding makeshift lineups in each game Saturday.

"I think you'd have to have your head in the sand to not know what we need to do,'' he said while the Astros-Diamondbacks game was still in progress. "We need to win."

He added, "I've been on both sides of that where you've played extremely well going into the playoffs and you don't play well in the playoffs, and you're not playing very well and then you run the table. That can go both ways. Everything starts new on Monday. That's not a concern, but it would have been nice to have home-field advantage wrapped up."

As for the year coming down to the last day, he said, "It's kind of been like that all year. We've been up and down and we've always seemed to bounce back when we need to bounce back, so we have to do it [Sunday].''

Said Chase Headley: "We just have to take care of what we need to do, and that's play better. We're not hitting with runners on base, we're not pitching great, so we have to find a way to play better and not worry about what everybody else is doing. It's not going to matter if we know where we're playing right now or if we [don't know] until tomorrow; we're frustrated because we're not playing the way that we want to. I'm not necessarily worried about where that game's going to be."

The Yankees rallied from a 3-1 deficit to tie Game 2, but in the eighth, Dellin Betances allowed two hits and threw two wild pitches, the second of which allowed the go-ahead run to score. "I yanked it,'' he said. "I was trying to go up with that fastball and I just yanked it."

The Yankees, who fielded a makeshift lineup in both games, were mostly shut down offensively. "Home-field advantage is extremely important to us, but I think one thing that tops home-field advantage is health," Girardi said before Game 1, explaining a lineup that included Jose Pirela (rightfield), Austin Romine (first base) and Brendan Ryan (shortstop) as the 7-9 hitters. "Playing guys two games today is risky in a situation . . . when it's cold and wet and rainy. It's not ideal, but I think it's the right thing to do."

In Game 2, Luis Severino pitched reasonably well on a raw night, allowing three runs and five hits in seven innings. With the score tied at 3-3, Girardi turned it over to Betances.

The 6-8 righthander allowed a bloop single to No. 9 hitter Paul Janish and then threw a wild pitch. He recovered to strike out Nolan Reimold butGerardo Parra bunted for a single to put runners at the corners. Betances got ahead of Manny Machado 1-and-2 but threw a 97-mph wild pitch that sailed wide of Brian McCann for a 4-3 Orioles lead.

Reimold led off the bottom of the first by sending an 0-and-1 fastball to left-center for his sixth homer. With two outs, Severino hit Chris Davis and allowed a double into the leftfield corner by Steve Pearce. Didi Gregorius' relay throw was in time, but McCann could not hold on to it as Davis slid across the plate.

Gregorius' sacrifice fly in the second made it 2-1, but Machado hit a two-out solo homer in the third.

Slade Heathcott had an RBI double that put runners on second and third with none out in the fifth. Carlos Beltran later walked with the bases loaded and two outs to tie it at 3-3.