Updated

It's not just that the Houston Astros have been losing. It's the way they are losing.

The Pittsburgh Pirates scored two runs in the ninth inning to beat the Astros 6-5 on Friday night.

The Astros have tied a franchise record with the 11 straight losses and they have lost 24 of 26.

"It's another tough loss," Astros outfielder Ben Francisco said. "We've had three games here we've lost in the ninth in this homestand."

That was a fact that was clearly in the minds of players and coaching staff.

"That's a positive," said Chris Johnson, who drove in two runs and came within a single of hitting for the cycle. "But we have to play all nine innings."

The Astros had not lost 11 consecutive games in a season since 1995.

Twice against the Cincinnati Reds earlier this week, the Astros entered the ninth inning with a lead only to give the game away.

Drew Sutton scored on a wild pitch in the ninth inning on Friday to propel Pittsburgh to its third consecutive win and eighth over the past 10 games.

Houston led 5-4 entering the ninth inning before rookie Starling Marte's bases-loaded sacrifice fly tied it up. A pitch from Xavier Cedeno got away from catcher Chris Snyder and allowed Sutton to score for the Pirates' first lead of the game.

Rhiner Cruz (1-1) came in for Houston with one out. Michael McKenry singled before Cruz issued consecutive walks to load the bases and then Marte hit a sacrifice fly.

Tony Watson (5-1) pitched a scoreless eighth for the win and Joel Hanrahan did the same in the ninth for his 31st save.

Pittsburgh starter Jeff Karstens yielded six hits and four runs with seven strikeouts in five innings. He allowed two home runs after giving up just one in his previous eight starts this season.

Johnson's quest for the cycle included a double in the first inning, a solo home run in the third and a triple in the seventh to go with a walk in the fifth.

Francisco finished 2-for-4 with a home run, two RBIs and a run scored, and J.D. Martinez went 3-for-5 and drove in a run for the Astros, who went 2-for-13 with runners in scoring position.

Jordan Lyles did his best to protect an early 3-0 lead. He denied the Pirates through the first three innings before giving up a solo home run to Alex Presley in the fourth and a two-run shot to McKenry in the fifth.

At that point the Astros were hanging to a one-run lead thanks to Francisco's solo home run to left in the fourth inning.

It was Francisco who first put the Astros on the scoreboard in the second inning, driving in Martinez from second base with a single to center.

After Karstens got Snyder to strike out swinging, Lyles doubled the Astros' lead with a one-out sacrifice bunt to score Justin Maxwell.

Lyles tied his career-high for strikeouts with eight in six-plus innings. He previously reached the mark June 16, also against the Pirates. His four earned runs came on seven hits, and he walked none.

"I didn't do a good job of closing the door," Lyles said.

The Pirates tied it in the seventh on a sacrifice fly by Josh Harrison off reliever Fernando Rodriguez.

Martinez drove in Johnson with a one-out single off Pittsburgh reliever Jared Hughes in the bottom of the inning after Johnson had a triple to lead off to put the Astros ahead 5-4.

The Astros were trying to avoid dwelling on their latest stumble.

"We're confident in ourselves in each other," Lyles said. "I think in general, everyone has to step up their game a little bit and it starts with starting pitching. I have to do a better job myself. Like tonight, I have to do a better job when they put up four runs for me."

NOTES: The Pirates have homered in 17 straight road games, which is tied with Oakland for the longest streak in the majors. ... The Astros claimed RHP Chuckie Fick off waivers from St. Louis on Friday. ... Mike Scott, who won the Cy Young Award with the Astros in 1986, threw out the first pitch on Friday night as part of the team's 50th anniversary celebration. ... Wandy Rodriguez, who was traded from the Astros to the Pirates on Tuesday, will start against his former team on Saturday in the third game of the four-game series.