NEW YORK (AP) Gleyber Torres and the New York Yankees are rolling into a season-ending divisional gauntlet taking solace in the standings.

''We're in control of things,'' manager Aaron Boone said. ''And there's some comfort in that. It's on us, it's right in front of us.''

Torres doubled home Joey Gallo for the tiebreaking run in the eighth inning, Gary Sanchez followed with a two-run homer and New York rallied past the Texas Rangers 7-3 Wednesday night for a three-game sweep and an inside track to a playoff spot.

Next up, a nine-game stretch that will decide its postseason fate.

The Yankees' wild-card chase takes them to Fenway Park for three games starting Friday night followed by three at Toronto and a season-ending three-game homestand against AL East-leading Tampa Bay.

New York is half a game ahead of the Blue Jays for the second and final AL wild card after Toronto lost a matinee to the Rays, who clinched a postseason spot with the victory. The Red Sox remained two games ahead of the Yankees after a blowout win against the Mets.

''There's some comfort in knowing we don't have to get help from anyone else,'' Boone said.

The Yankees made two errors, allowed two stolen bases, had a baserunner sprint through a stop sign but score easily and another thrown out at home plate.

They escaped with a win over the last-place Rangers. It's about to get significantly tougher.

New York won its third straight following a 7-15 slump. It scored four runs with two outs in the eighth inning after Gallo reached versus his former team when his popup off Spencer Patton (1-2) dropped in deserted left field against the shifted Rangers.

Torres followed with a liner into the right-field corner for a 4-3 lead, then scored from second when second baseman Yonny Hernandez bobbled Gio Urshela's grounder. Torres dived for the corner of the plate and just eluded Jose Trevino's tag. The safe call was upheld by a replay review.

Sanchez, a substitute on defense in the top of the inning, connected for his 23rd homer to dead-center for a four-run cushion. He also threw out a runner trying to steal second in the eighth.

''When he's rolling, we're a great team, so it was great to see that swing from him,'' said fellow Yankees catcher Kyle Higashioka, who had two hits and two RBIs before being lifted for a pinch-runner.

Chad Green (9-7) pitched a scoreless eighth, and Aroldis Chapman cruised through the ninth in a non-save situation.

Rangers starter Taylor Hearn held the Yankees in check until walking consecutive batters with one out in the sixth. Dennis Santana relieved, walked Gallo to load the bases and threw a wild pitch to let a runner score and tie it at 3 before getting out of the inning with consecutive strikeouts of Torres and Urshela.

Texas chipped away against starter Corey Kluber with eight hits - including six singles - and three runs over 4 1/3 innings. The 35-year-old struck out four and threw 84 pitches. Texas stole two bases against Kluber and also beat out consecutive potential double-play grounders in the second that stretched his pitch count.

Higashioka cut New York's deficit to 3-2 with a two-run double in the fifth, with Urshela scoring from first without a throw home after running through third base coach Phil Nevin's stop sign. Nevin flashed Urshela a thumbs-up after.

''I don't know that I've seen Gio run so fast,'' Boone said.

Rangers right fielder Adolis Garcia threw Higashioka out at home for the last out of the inning when Higashioka tried to score from third on DJ LeMahieu's fly ball. Garcia's throw as clocked at 95.5 mph and was the 14th assist this season by the AL Rookie of the Year favorite.

''Anytime somebody challenges that arm, he always seems to put it right on the bag,'' Rangers manager Chris Woodward said.

It was the major league-most 21st out made at home plate by the Yankees this year.

Hearn was charged with three runs, four hits and four walks, striking out three. Texas has lost six straight against New York this season and with 97 losses is headed to its worst record since 1985.

''It was a good atmosphere for our guys to witness,'' Woodward said. ''It's a playoff atmosphere. These guys are fighting for a playoff spot. Kind of got the better of us at times.''

COLE'S GOAL

Yankees ace Gerrit Cole will start Friday at Fenway Park. The right-hander said he was drawing inspiration in the homestretch from a story he had been told recently about ancient warriors honing their warfare skills against elite fighters from neighboring cities to stay sharp.

''If they weren't practicing against the best that they could find, they may be surprised if a formidable army came out of somewhere and they hadn't been practicing against elite opponents,'' he said. ''So maybe that's similar to this situation, where we've been playing against a lot of elite opponents.

''Sure we've lost some of the battles, but we still have the war ahead of us,'' he added.

TRAINER'S ROOM

Yankees: RHP Domingo German (right shoulder inflammation) was activated from the 10-day injured list and available out of the bullpen. ... OF Aaron Judge was New York's designated hitter for a second straight game, and Boone said the slugger was a little banged up. Judge downplayed the discomfort, saying it's normal wear and tear near the end of a season.

UP NEXT

Yankees: Cole (15-8, 3.03) will face Red Sox RHP Nathan Eovaldi (10-8, 3.58) in a showdown of pitchers likely to receive AL Cy Young Award consideration.

Rangers: Travel to Baltimore for a four-game set that starts Thursday. Texas RHP Glenn Otto (0-2, 9.37) is set for his fifth big league start. The Orioles hadn't announced a starter.

---

Follow Jake Seiner: https://twitter.com/Jake-Seiner

---

More AP MLB: https://apnews.com/hub/MLB and https://twitter.com/AP-Sports

Copyright 2024 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.