NEW YORK (AP) -- Two nights in a row, the Red Sox have pulled off the final rally at Yankee Stadium.
Mike Napoli hit a tying grand slam in the seventh, Shane Victorino had a go-ahead homer one inning later and Boston beat the New York Yankees 12-8 on Friday night for its fourth straight victory.
Will Middlebrooks went deep for the third straight day and the Red Sox erased a five-run deficit in another wild game between these longtime rivals. One night earlier, the Yankees took an 8-7 lead with a six-run seventh - only to lose 9-8 in 10 innings on Victorino's tiebreaking single.
''We never feel like we're out of it,'' Boston manager John Farrell said.
New York has lost consecutive games when scoring at least eight runs for the first time since September 1949, according to STATS. The last time it happened with both games at home was 1911 against Cleveland.
Napoli also doubled, singled and walked twice in a perfect night at the plate. He scored three times, one night after sparking Boston's ninth-inning comeback with a two-out single off closer Mariano Rivera.
The Red Sox, who began the day with a 6 1/2-game lead in the AL East over Tampa Bay, have slowed New York's wild-card charge by winning the first two in a four-game set to improve to 9-5 against New York this year. They have scored 41 runs in their past three games and won 11 of 13 overall.
''We don't give up, we don't give in,'' Middlebrooks said. ''It doesn't matter what the scoreboard says. We're going to come out, we're going to fight, we're going to grind it out.''
Alfonso Soriano homered and Brett Gardner hit a two-run triple for the Yankees, but Phil Hughes and their depleted bullpen failed to preserve an 8-3 lead for Andy Pettitte. New York went hitless after the fifth inning - and there was more bad news after the game.
Boone Logan came out with tightness in the back of his elbow, one batter after serving up Napoli's slam. The left-hander will have an MRI on Saturday.
Top setup man David Robertson is expected to be sidelined five or six days with tendinitis in the back of his right shoulder.
Not to mention, Rivera was unavailable after pitching three straight days.
''We've been dealing with this all year long,'' manager Joe Girardi said. ''So it's a chance for other guys to step up, and they're going to get an opportunity.''
Victorino connected for a two-run shot off Preston Claiborne (0-2) in the eighth. Joba Chamberlain walked in a run later in the inning, and Stephen Drew made it 12-8 with an RBI single.
Brandon Workman (5-2) threw 1 1-3 hitless innings and Koji Uehara pitched a perfect ninth, running his scoreless streak to 27 innings over 24 games. He has retired 27 consecutive batters.
''That would be a perfect game,'' Farrell said.
''Let's get the champagne then,'' Middlebrooks chimed in.
The game lasted exactly 4 hours, one night after the teams played 10 innings in 4:32.
Fired up all night, the 41-year-old Pettitte was pulled after six innings and 100 pitches. He struck out eight, but the bullpen betrayed him again.
In his previous outing, Pettitte was ahead 3-0 after 93 pitches when Baltimore chased him in a seven-run seventh inning. This time, Boston scored five runs in the seventh off Hughes and Logan.
Short in the bullpen after using seven relievers Thursday night, Girardi called on Hughes to begin the seventh - his first relief appearance since 2011. After going 4-13 with a 4.86 ERA in 26 starts this season, Hughes was demoted to the bullpen this week.
''It's different, for sure. But you've got to find a way to adjust and, obviously at this time of the year, you've got to adjust pretty quickly,'' Hughes said.
He gave up two singles and a nine-pitch walk to pinch-hitter Mike Carp after getting ahead 0-2. Dustin Pedroia drove in a run with an infield single, and Hughes walked off to boos from the crowd of 44,117.
Logan struck out David Ortiz and went to a full count on Napoli before he lofted a high fly toward the short porch in right. Ichiro Suzuki made a desperate leap, but the ball bounced off the ledge just behind the fence and caromed up into the crowd for Napoli's sixth career slam and third this season. He hit one off Hughes at Yankee Stadium on June 1.
''Just got enough,'' Napoli said.
He raised his fist as he rounded first and received hearty high-fives when he returned to the dugout.
Daniel Nava then whistled a single past Logan's ear, and the reliever left with a sore arm.
Red Sox starter Felix Doubront was all over the place, throwing only 46 of his 88 pitches for strikes in 3 2-3 innings. He gave up three hits - two triples and a homer. Four of the six hitters he walked scored.
Derek Jeter walked in the first inning and Soriano followed with his 30th home run of the season, 13 for New York. He has 43 RBIs in 39 games since the Yankees reacquired him from the Chicago Cubs on July 26.
Middlebrooks, batting ninth, homered leading off the fifth to give him eight RBIs in his last four games. But the Yankees made it 8-3 in the fifth on RBI singles by Vernon Wells and Mark Reynolds.
NOTES: Linda Pizzuti, the wife of Red Sox owner John Henry, tweeted a photo of the birthday cake - with a Yankees logo - that she said the Yankees made for Red Sox President and CEO Larry Lucchino as they celebrated at the ballpark. ... Red Sox CF Jacoby Ellsbury sat out with a sore right foot. ... C Jarrod Saltalamacchia missed his fourth consecutive game with a sore back. Saltalamacchia worked out during early batting practice and it's a ''real possibility'' he could be in the lineup Saturday, Farrell said. ... LHP David Huff, tabbed to replace Hughes in the rotation, makes his first start for the Yankees on Saturday against RHP John Lackey (8-12, 3.22 ERA).