The Yankees' victory ensured them at least a tie for an American League wild-card playoff spot and all but eliminated the Red Sox from post-season contention.
Robinson Cano forced an extra frame with a score-tying, RBI single in the ninth inning. In the next frame, Okajima (4-4) loaded the bases and then forced in Brett Gardner with a game-ending walk to Miranda.
Alex Rodriguez helped the Yanks snap a four-game losing streak with a two-run homer.
New York cut Tampa Bay's lead in the AL East to a half-game with the victory.
Jonathan Papelbon recorded his eighth blown save of the year when he squandered a one-run Red Sox lead in the ninth.
Victor Martinez and Bill Hall each had two runs and an RBI for Boston.
Copyright 2010 United Press International, Inc. (UPI).