Orioles right-hander Chris Tillman isn’t sure why it is happening, but he knows he needs to be better early in games if he’s going to continue his ascent as a major league starter.

On Sunday, in the Orioles’ 5-2 loss to the Houston Astros, Tillman walked the first two batters he faced and then gave up a three-run homer to Jason Castro to immediately put his team down three runs.

Tillman didn’t allow a run during the remainder of his five-inning outing, but it didn’t matter. The outcome was determined after the first three batters.

“He just never quite got in sync, but a lot of guys would have imploded there,” Orioles manager Buck Showalter said about Tillman. “He kept us in the ballgame and threw some zeros up after that. But it wasn't what he's capable of, or what we've come to expect. Or, more importantly, what Chris has come to expect.”

Tillman (3-2) has allowed 21 earned runs in eight starts this year for a 3.97 ERA; seven of those runs have come in the first inning and six more in the second inning. In his first two innings, he has pitched to an ERA of 7.31; his ERA after the second inning is 2.27.

“I got nothing. I got nothing,” Tillman said as an explanation to why he has struggled early. “Once I notice what’s going on, [I’m fine]. I guess I need to notice it earlier; kind of find out what’s going on, and how to deal with it.”

Overall, Tillman allowed four hits and a season-high five walks while striking out three against baseball’s worst hitting club. He threw 105 pitches, including 32 in the first inning, against an Astros team that had 11 hits Sunday after entering the game with a majors-worst .220 average.

Tillman’s first inning wasn’t even his least efficient this season. On May 1, he threw 49 pitches while giving up two runs in the first inning against the Pittsburgh Pirates. He has allowed two or more runs in the first inning in each of his last three starts.

“It’s one of those things where I had a tough first inning, and then [I] make some adjustments and it comes to me,” Tillman said. “I’d like to recognize that a little bit earlier.”

The loss snapped the Orioles’ season-best five-game winning streak and prohibited them from securing their first three-game series sweep at Camden Yards this season. But the Orioles (20-15) remain in first place in the American League East, 1 1/2games ahead of the New York Yankees.

The Astros (12-26) won for just the third time in 12 games and still have the worst record in the majors.

For a while, it looked like the Orioles might make it three consecutive games in which they came back to beat the Astros. They cut Houston’s lead to 3-2 in the third inning on Adam Jones’ two-run single for his 500th and 501st career RBIs. But the club failed to take advantage of multiple opportunities against Houston right-hander Jarred Cosart (2-3).

Only once did Cosart have a clean inning, but the Orioles left six runners on base in six innings against him.

Their best chance against Cosart came in the fifth, when Nick Markakis walked and Chris Davis — in his first game with the club since coming off the 15-day disabled list — doubled with one out.

Cosart then struck out Jones, and Nelson Cruz hit an inning-ending flyout to strand the runners at second and third. The Orioles never threatened again. Five of their six batters struck out against reliever Tony Sipp, and Chad Qualls picked up his second save with a scoreless ninth.

In the seventh, Houston first baseman Marc Krauss hit a two-run homer to right against left-handed reliever T.J. McFarland to give the Astros another three-run lead. McFarland allowed two runs and seven hits in three innings of relief. He was optioned to Triple-A Norfolk after the game, and the Orioles will promote a long reliever Monday to fill the spot.

“T.J. gave us a blow in our bullpen like we know he's capable of,” Showalter said. “He'd like to have the pitch back to Krauss.”

Markakis extended his hitting streak to 18 games, one less than his career high, with a single in the third inning. Davis had two hits in four at-bats in his first major league game since April 26.

“[The pitchers] are all tough up here,” Davis said. “I think it was good to see a guy who was going to challenge me here. With the intent to just see it and hit it, I was able to put a good swing on it and hit a couple hard.”

The Orioles’ offense should be tested for the remainder of the homestand. The Detroit Tigers, who have baseball’s best record, head into Camden Yards for three games starting Monday.

Tillman won’t pitch again until Friday night in Kansas City. And the Orioles know they need him if they are going to continue their hot May.

“He just hasn't quite gotten in sync consistently. And he will,” Showalter said. “Fortunately for us, he kept us engaged in the game at 3-2. I take that as a positive. A lot of guys wouldn't [have maintained focus], and I think that's a sign of his maturity.

“I know Chris is probably a little frustrated with today, all things considered.”

dan.connolly@baltsun.com

twitter.com/danconnollysun