HOUSTON — Despite having ace Masahiro Tanaka on the mound, the surging Yankees ran into a speed bump in the form of Lance McCullers, who struck out 10 and allowed only five hits in six innings of a 4-1 Astros victory Wednesday night at Minute Maid Park.

Ken Giles, Luke Gregerson and Will Harris held the Yankees hitless over the final three innings and recorded five more strikeouts. The Yankees still recorded their third straight series win and have an off day today before a three-game series that begins tomorrow at Tampa Bay. The loss left them four games out of the second wild-card position.

The common thread in the 8-2 streak the Yankees carried into the series finale was quality starting pitching, and with Tanaka working on a 4-0 streak in his past seven starts, they figured to be in good position for the sweep.

Speaking of his team’s improved play against high-caliber opposition, manager Joe Girardi said, “It just tells you we’re able to play with these teams, and I think it all starts with our starting pitching. Our starting pitching has been really good, our bullpen has been really good, and I’ve always said that’s how you put long streaks together.”

Tanaka was coming off an 83-pitch outing Friday night in a no-decision against the Giants, hadn’t thrown more than 93 pitches in any of his past three starts and figured to be relatively fresh. Girardi admitted the need to keep him fresh was part of his reasoning about keeping Tanaka’s pitch count low. But with back-end relievers Andrew Miller and Dellin Betances unavailable Wednesday night, Girardi was hoping for length from his ace.

It didn’t happen. Tanaka (7-3) threw 94 pitches but got through only five full innings. He left trailing 4-1 after giving up seven hits, walking two and striking out four.

Tanaka’s problems began in the second inning when he issued consecutive one-out walks to Preston Tucker and Alex Bregman before a double by Carlos Gomez scored Tucker. The damage was minimal in that inning, but the game got away from Tanaka in the third.

Marwin Gonzalez hit a leadoff single, went to second on a groundout and moved to third on a wild pitch before scoring the Astros’ second run on a single by Carlos Correa. The next hitter was Colby Rasmus, who launched a splitter deep into the seats in right-center for a 4-1 lead. Rasmus’ homer ended an 0-for-29 slump. Tanaka retired eight of the last 10 batters he faced, but there was no need to push him with the Yankees struggling against McCullers.

After bashing 13 hits in Tuesday’s win, the Yankees struggled against a different look from McCullers, who relied heavily on a knuckle curve that had them flailing. The only run off McCullers came when cleanup hitter Brian McCann led off the fourth by blasting the first pitch, a 93-mph fastball, just over the top of the wall about 415 feet deep in left-center.

Mark Teixeira struck out, but the Yankees had an opportunity to get back in it when Didi Gregorius singled and Starlin Castro walked. McCullers got out of the jam by striking out Chase Headley and Aaron Hicks to begin a streak of five strikeouts.

A-Rod sits on birthday. Asked if he considered starting Alex Rodriguez last night as a birthday gesture, Girardi said, “No, I mean, Carlos [Beltran] has played every day in this 13 days [since the All-Star break]. I think it’s important that I DH him.”