Robert Andino's three-run double in the eighth 5, in the third installment of a four- game series.
Willie Eyre (2-1) recorded the final two outs in the seventh for the win. Jim Johnson tossed a scoreless ninth to post his eighth save.
Daniel Bard (2-9) was charged in defeat with two runs on two hits in 1 1/3 relief innings.
Boston fell six back of the Yankees in the AL East after New York topped Tampa Bay. The Sox remained two games up on the Rays in the wild card race.
The O's forged ahead for good in their second-to-last turn at the plate. Matt Wieters hit a leadoff single against Bard, then Reynolds followed with a one- out hit and, after Jonathan Papelbon was summoned, Nolan Reimold contributed a two-out single to load the bases. Andino followed with his bases-clearing double to right for a 7-5 contest.
"He got ahead on Reimold and tried to go up and away and misfired," said Boston manager Terry Francona about Papelbon. "Then he got in a deep count to Andino and he cleared the bases. Pap has been so good for us this year and hopefully we can get him back in there tomorrow."
Pedro Strop retired the side in order in the home half. In the ninth, Jacoby Ellsbury reached on catcher's interference, but was promptly erased on Dustin Pedroia's double-play grounder. Gonzalez grounded out to first to end the game.
The Sox picked up a run in the first as Dustin Pedroia doubled with one out and scored when Gonzalez followed with a double.
Baltimore countered with four in the third on a Markakis RBI double, a Josh Reddick fielding error which scored Markakis, and a Reynolds run-scoring hit. but Boston pulled within 4-3 in the home half as Pedroia led off with a double and came in on a Gonzalez two-run shot.
O's starter Rick VandenHurk lasted three-plus innings, allowing seven hits and five runs -- four earned -- with three walks and four strikeouts...His counterpart Erik Bedard served up five hits and four runs -- one earned -- with a pair of walks in just 2 2/3 frames...Boston still leads the season series, 9-5...Ellsbury finished 1-for-4, giving him 200 hits on the season. Along with Gonzalez, it marked just the third time in franchise history that two players have reached 200 hits in one season, after Wade Boggs and Bill Buckner (1985), and Boggs and Jim Rice in 1986.