BALTIMORE -- Somehow the Yankees have managed what was unthinkable only two or three days ago: They have inserted 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 twice (21-5 on Friday night and 6-2 Saturday night) and the Yankees dropped a doubleheader to the Orioles on Saturday (9-2 in Game 1 and 4-3 in Game 2) at a damp and chilly Camden Yards.

The Astros (86-75) moved to within one game of both the Yankees (87-74) and AL West-leading Rangers (87-74) entering the final day of the regular season. Both teams have tiebreaker advantages over the Yankees. If the Astros win and the Rangers lose Sunday, they will have a playoff game to decide the AL West champion and the loser will host the Yankees in the wild-card game. If the Astros lose Sunday, the Yankees will host the wild-card game regardless of how they do against the Orioles.

Last Sunday, the Yankees had a 41/2-game lead over the Astros and a magic number of three to finish ahead of them. But since then, the Astros are 4-1 and the Yankees are 1-5.

Michael Pineda will face the Orioles' Chris Tillman in Game 162. Said Dellin Betances: "We have to win. It's all up to us. We can't depend on anybody else . . . The ball's in our hands. All we have to do is win."

Joe Girardi said he will use his full lineup Sunday 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."

advertisement | advertise on newsday

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."

Yankees videos

The Yankees rallied from a 3-1 deficit to tie Game 2, but in the eighth, 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."

Luis Severino allowed three runs and five hits in seven innings, and with the score tied at 3-3, Girardi turned it over to Betances, who allowed a bloop single to No. 9 hitter Paul Janish and then threw a wild pitch. He recovered to strike out Nolan Reimold but Gerardo 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 for a 4-3 Orioles lead.

Zach Britton pitched a scoreless ninth for the save. He allowed a one-out single to pinch hitter Alex Rodriguez, but pinch-running specialist Rico Noel was picked off.

Said Noel, "He came over with a different pick [pickoff move] and I didn't get to second. That's how it goes sometimes. I was pretty much going first move. I have to be ready for that next time."

Reimold led off 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.

advertisement | advertise on newsday

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

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

The Yankees were mostly shut down all day as Girardi opted to rest players. "Home-field advantage is extremely important to us, but I think one thing that tops home-field advantage is health," he said before Game 1, explaining a lineup that included Jose Pirela (rightfield), Austin Romine (first base) and Brendan Ryan (shortstop). "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."

The Game 1 lineup produced little against Baltimore lefthander Wei-Yin Chen, who shut them out for the first six innings of Game 1 before the Yankees drew within 7-2 in the seventh.

The Yankees, who had six hits in each game, went 1-for-12 with runners in scoring position and stranded eight in Game 1 and 2-for-7 with six stranded in the second. The Orioles had 15 hits, including four by Parra, in Game 1 and seven in Game 2, including two more by Parra.

advertisement | advertise on newsday

Chen (11-8, 3.34) allowed two runs and four hits in six innings-plus. Yankees righthander Ivan Nova, a long shot to be carried on the postseason roster, allowed five runs and eight hits in 52/3 innings.

Nova (6-11, 5.07) departed with two on and two out in the sixth, giving way to struggling lefthander Chasen Shreve. He gave up three straight singles, threw a run-scoring wild pitch and issued a walk, allowing two inherited runners plus two of his own runners to score as the Orioles extended their lead from 3-0 to 7-0.