BALTIMORE — Clay Buchholz was in pitching purgatory for much of July. The righthander had a spot on the roster with the Red Sox but no role other than to wait.
Outside of David Ortiz and Dustin Pedroia, Buchholz has the most tenure on the club and well-meaning teammates and coaches offered suggestions on what he could do to improve.
Unexpectedly, it was hitting coach Chili Davis who had the best advice. Try pitching only out of the stretch, he said. Abandon your leg kick and that will make it harder for hitters to get their timing.
In time, it started to work. The hitting coach helped fix a pitcher.
“That doesn’t always happen that way,’’ Buchholz said. “Chili played the game a long time and I respect everything he talks to me about.’’
Buchholz has been an increasingly more valuable pitcher since. He threw seven strong innings on Wednesday night as the Sox stepped closer to the American League East title with a 5-1 victory against the Baltimore Orioles.
An ill-timed error by the Orioles and Andrew Benintendi’s three-run homer in the sixth inning gave Buchholz the victory. The Sox have won a season-best seven straight and 15 of 20.
At 88-64, the Sox lead the Toronto Blue Jays by five games and the Orioles by six with 10 games to play. The Sox’ magic number is six with David Price starting on Thursday night.
“This has been a lot of fun,’’ Buchholz said.
Compared to what it was for him, it’s every holiday rolled into one. Buchholz was 3-9 with a 5.91 earned run average in 18 games prior to the All-Star break and at one point went nearly 20 days without pitching.
He is 5-1 with a 3.59 ERA in 18 games since. Buchholz has appeared in nine games since Aug. 18, starting six. The Sox are 7-2 in those games with Buchholz posting a 3.61 ERA.
As the Sox surge to the postseason, he has been one of their leaders.
“When many were calling for his head we knew there was a talented guy here and we needed to get him on track,’’ manager John Farrell said. “To his credit, as we’ve said many times, he went to the bullpen and worked some things out. You know what, he’s pitching his best baseball of the season right now.’’
Pitching out of the stretch has simplified Buchholz’s delivery. He also works at a quicker pace, something that has been a problem for several years.
“I knew I wasn’t going to be bad all year,’’ he said. “It was just a stretch that I didn’t really know what was going on. I didn’t know how to fix it and when I tried to fix it I was trying too hard and overdoing a lot of things.’’
Buchholz handled the Orioles with relative ease outside of the third inning.
Jonathan Schoop led off with a single before Matt Wieters put down a bunt. Catcher Sandy Leon tried to make a play at second base and threw wildly. He would have had an easy out at first.
J.J. Hardy drew a walk to load the bases and a run scored on a sacrifice fly to left field by Adam Jones.
Buchholz ended the inning from there. Hyun Soo Kim grounded to first and Manny Machado fouled out to Leon.
“That was big because one run isn’t much for our offense,’’ Buchholz said.
Baltimore starter Ubaldo Jimenez took a 1-0 lead into the sixth inning, an assortment of off-speed and breaking pitches keeping the Red Sox off balance. He twice left the bases loaded.
Jimenez was at 91 pitches going into the sixth inning. He walked David Ortiz before Mookie Betts singled. Jimenez stayed in to face Travis Shaw and struck him out for the second time.
Facing Brad Brach, Aaron Hill reached on an infield single to load the bases but Jackie Bradley Jr. struck out.
Leon, who grounded into a double play with the bases loaded in the fourth inning, came to the plate again. He worked the count to 2 and 2 before grounding a ball wide of first base.
Chris Davis scooped up the slow roller but made a hurried throw to first base that got past Brach. Two runs scored.
“We were given a gift,’’ Farrell said.
Benintendi was next and he drilled a first-pitch fastball over the scoreboard in right field for his second home run.
“I was just trying to get something early in the count,’’ Benintendi said. “These last few games I’ve played, feels like I’ve had two strikes on me every time. Looking for something out over the plate.’’
Benintendi has not played consecutive games since returning from a sprained left knee. Those days may be over given his production. He is 26 of 82 (.317) with 12 extra-base hits and 13 RBIs in 25 games.
Farrell said Benintendi would play on Thursday and could well move up in the order.
“It was fun watching but I wanted to get out there,’’ Benintendi said.
Given a 5-1 lead, Buchholz ended his night with two perfect innings.
“Those were maybe his best two innings of the season,’’ Farrell said.
The Orioles advanced one runner into scoring position over the final six innings against Buchholz and three relievers. Sox pitchers retired 14 of the final 15 batters.
Peter Abraham can be reached at pabraham@globe.com. Follow him on Twitter @PeteAbe.