BOSTON -- The New York Yankees' bats arrived just in time to help extend their longest win streak of the season.
Gary Sanchez hit a tying home run with two outs in the ninth inning, DJ LeMahieu had a go-ahead double in the 12th and the Yankees rallied past the Boston Red Sox 6-5 Friday night for their ninth straight victory.
New York improved to 8-0 over its longtime rival this season. Dating to last year, the Yankees have won 11 in a row over the Red Sox, one short of its best streak ever against them.
"I had absolute confidence we were going to find out a way back in this game," LeMahieu said. "I feel like we're playing like we should be playing. . We're all clicking."
The victory moved the Yankees (30-21) percentage points ahead of Minnesota (31-22) for the No. 4 seed and home field in the first round of the playoffs. The fourth-seeded club will host the No. 5 team in every game of the best-of-three series.
The Yankees won on a night in which sluggers Aaron Judge and Giancarlo Stanton were both in the lineup together for the first time since Aug. 8 after recently returning from stints on the injured list.
Sanchez said their return come at a perfect time.
"They're key pieces to our team," he said through a translator. "When they are in the lineup they have certain energy and an intimidation factor."
The Yankees, coming off hitting a record 19 home runs in three days against Toronto, trailed 4-3 with two outs in the ninth.
Sanchez, who's shown recent signs of breaking out of a season-long slump, tied it with a line drive home run off Matt Barnes that just made it over the top of the Green Monster.
"He was sitting on a curveball, and he got it and he didn't miss it," Red Sox manager Ron Roenicke said.
Sanchez hit a two-run double in the seventh that cut Boston's lead to 4-2.
Luke Voit hit an RBI single in the 11th for the Yankees. Boston tied it in its half of the inning thanks to a wild pitch by Loaisiga and an RBI single by Christian Arroyo, who also had a three-run homer.
LeMahieu doubled with two outs in the 12th.
Boston's Martin Perez pitched six scoreless innings, allowing just three hits, a walk and striking out seven. But the Red Sox relievers allowed five hits and four runs over the next three innings.
This was Judge's second game back since re-aggravating a strained right calf on Aug. 26. Stanton was activated Tuesday after going on the injured list Aug. 9 with a left hamstring strain.
Both were quiet until the eighth inning when Judge got aboard with a one-out single. Stanton then lined a double into the left field corner, scoring Judge from first to cut Boston's lead to 4-3.
Judge and Stanton went a combined 2 of 9, striking out three times.
Yankees manager Aaron Boone said he was proud of how his team hung in throughout the various momentum swings of the game.
"It's starting to be playoff baseball," Boone said. "There were a lot of big pitches on both sides. A lot of big at-bats on both sides. ... The guys didn't mail it in at all. They kept grinding, battling and fought their way back in the game."
Yankees: Boone said the team will be careful with Judge and Stanton's workload as they gear up for the postseason. He said Stanton will likely have Saturday off after playing two straight games. Judge will probably rest in the series finale on Sunday.
Red Sox: RF Alex Verdugo left the game in the third inning with left hamstring tightness after injuring himself while running the bases.
Yankees: LHP J.A. Happ (1-2, 3.96 ERA) will make his eighth start of the season. He had a no-decision in his last start when he went five innings Sept. 13 against Baltimore, giving up five hits and a run.
Red Sox: RHPr Chris Mazza (1-1, 5.57) makes his fifth start of the season. He's given up 10 runs over 14 1/3 innings in his four previous starts.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Los Angeles Dodgers tab Clayton Kershaw to start Game 1 of World Series
Clayton Kershaw will start for the Dodgers in Game 1 of the World Series against the Rays on Tuesday.
2020 MLB World Series Best Bets - Tampa Bay Rays vs. Los Angeles Dodgers
Sixteen teams down to two for the 2020 MLB World Series. Our guys make their picks to who will be crowned champion of the MLB season.
Tyler Glasnow, Blake Snell to start first 2 World Series games for Tampa Bay Rays
Tyler Glasnow will start Tuesday night's World Series opener for the Tampa Bay Rays against the Los Angeles Dodgers, and Blake Snell will be on the mound for Game 2 on Wednesday night.
Washington Nationals name Jim Hickey as new pitching coach
The Nationals have named Jim Hickey as the team's new pitching coach. He replaces Paul Menhart, who was not brought back after his contract expired.
Sorry Atlanta -- With Braves' MLB playoff loss and Falcons' collapses, it's been a tough month
The Braves blew a 3-1 series lead to the Dodgers in the NLCS. Given the Falcons' history of blowing leads just this season, it added to a terrible sports month on Atlanta.
Bill Miller, umpiring fourth World Series, named crew chief
Bill Miller will be the umpire crew chief for the World Series and will work home plate for Game 3 between the Dodgers and Rays. Laz Diaz will be behind the plate for Tuesday's opener.