After Ibanez's homer, they loaded the bases against Bailey in the ninth but Mark Melancon relieved and got Teixeira to pop up to an outfield playing in and Robinson Cano to ground out.
Ibanez has 19 homers this season, 10 of them tying the game or putting New York a lead.
Managing as if this were a playoff game, Girardi used much of his well-rested bullpen. He called on Rafael Soriano for the ninth, trailing 2-1, and the closer gave up a leadoff homer to James Loney, rankling many of the 41,564 who stayed through the rain.
He also pitched the 10th, walking one batter. It was the first time this season Soriano pitched more than 1 1-3 innings. Soriano threw 43 pitches, his most since Sept. 25, 2005.
"Hopefully, he feels OK tomorrow if I need him," Girardi said. "I've said it all along and I'll say it again: trying to win the division."
Jacoby Ellsbury and Dustin Pedroia were back in Boston's lineup a day after sitting out of a 10-2 loss and immediately made an impact. Ellsbury, who sat against left-hander CC Sabathia, singled and scored from first on a double to right-center by Pedroia, playing with a broken left ring finger. Cody Ross added a sacrifice fly against David Phelps for a 2-0 lead.
"He had great at-bats all night. He's an amazing character," Valentine said.
Eduardo Nunez had an RBI single off Jon Lester after Granderson reached on an infield hit, advanced to second on a throwing error by third baseman Pedro Ciriaco on the play and then stole third base.
Teixeira grounded out with runners on first and second to end the fifth and was booed by the many fans who remained in their seats.
The Yankees had runners on second and third with two outs in the seventh against Rich Hill and Ichiro Suzuki came up to chants of "Ich-iro!" He hit a sharp line drive to center field that was caught by Ellsbury.
NOTES: Yankees top pitching prospect Manny Banuelos is scheduled to have reconstructive surgery on his left elbow Thursday. Dr. James Andrews will perform the Tommy John surgery. The 21-year-old Banuelos is expected to miss the 2013 season. ... Boston entered the game 24 games out of first place. The previous time they were that far out was after games of Sept. 22, 1969. ... Boston's Daisuke Matsuzaka (1-6) faces New York's Hiroki Kuroda (15-11) in the regular-season finale.