Updated

Oakland, CA (SportsNetwork.com) - Wade Miley combined with two Boston relievers on a five-hit shutout as the Red Sox came through with a 2-0 victory over the Oakland Athletics in the rubber match of a three-game set.

Miley (2-4) was able to halt a three-start winless streak despite getting into several jams during his 6 2/3-inning stint. He struck out just one and walked four, but limited the A's to five hits and did his best work with runners aboard.

"He dodged some bullets along the way, but he did an outstanding job for us," Red Sox manager John Farrell said of Miley.

The lefty was aided by an Oakland offense that went 0-for-14 with men in scoring position, resulting in yet another close loss for the A's and spoiling the latest strong effort from ace Sonny Gray.

"It was horrible offense," A's outfielder Josh Reddick said. "We've got to do a better job, bottom line."

Gray (4-1) fanned nine over seven innings and yielded just three singles, one a blooper from Daniel Nava that drove in a run in the second.

Nava, Dustin Pedroia and Hanley Ramirez all finished with two hits to help Boston claim its first series win in Oakland since sweeping a two-game set in April 2008.

Miley never had a clean inning and was often in trouble, but was able to keep the A's off the board by making pitches in tough spots.

Oakland stranded four over the opening two frames, with Miley recording three straight outs to leave two in scoring range in the first. Marcus Semien tripled to lead off the third and was kept there as well, as Miley induced popups from Reddick and Billy Butler before retiring Brett Lawrie on a groundout.

"In the first three innings, they got a number of guys in scoring position with less than two outs ... and he never gave in," said Farrell of Miley. "He got some quick outs. We were able to get a number of popups on the infield, he got a key strikeout in one situation."

That last escape job protected a 1-0 lead the Red Sox were able to manufacture off Gray an inning earlier. Ramirez singled and moved to second on a wild pitch prior to Nava -- mired in an 0-for-20 slump -- having a pop fly drop into an uncovered area in short left field.

The A's threatened once more against Miley in the bottom of the sixth, which Butler began with a single and Lawrie followed with a walk. Oakland again came up empty, though, with Miley setting down the next three hitters to keep it a one-run game.

Semien's MLB-leading 12th error of the season enabled Boston to put up an insurance run with Gray, who retired the last 13 he faced, out of the game in the eighth. The Oakland shortstop air-mailed a ball to first on Pedroia's infield single as Nava, having reached earlier on a single off Evan Scribner, raced home from second.

Junichi Tazawa tossed 1 1/3 perfect innings in relief of Miley, and Koji Uehara yielded only a two-out walk in the ninth en route to his seventh save.

Game Notes

Oakland's Coco Crisp snapped an 0-for-39 skid that dated back to last season with an infield single in the fifth inning. The streak, which included an 0- for-26 stretch to begin this season, was the second-longest hitless sequence in franchise history. Jose Canseco had an 0-for-40 rut from Aug. 8-23, 1986 ... Semien's error was his sixth in five games ... The Athletics fell to 1-11 in day outings this season and are now 2-16 in games decided by two runs or fewer ... Gray permitted one earned run or fewer for the sixth time in eight 2015 starts ... Boston improved to 3-3 on a 10-game trip that continues Thursday in Seattle.