The Houston Astros had the bases loaded in the 11th inning and failed to score. Then the Miami Marlins loaded the bases in the bottom of the inning and took advantage.

Missed opportunities on Sunday doomed the Astros, who went 0 for 9 with runners in scoring position and lost 5-4.

Omar Infante and Hanley Ramirez hit the Marlins' first homers in their new ballpark, activating the much-discussed home-run sculpture. Ramirez tied the game in the eighth against Wilton Lopez with a two-run homer that cleared the 418-foot sign in center field, then singled home the winning run with one out in the 11th.

Meanwhile, the Astros squandered chance after chance. They left the bases loaded three times in the final six innings and stranded 13.

"We're struggling," right fielder Brian Bogusevic said. "We aren't coming up with the hits we need. We've been one or two at-bats from pulling ahead or busting it open."

Bogusevic tapped out to end the 11th. The Astros had a runner at second with one out in the 10th, but Chris Johnson was doubled off when second baseman Infante retreated to catch Jose Altuve's looping liner.

The Marlins stranded 12 but finally cashed in. John Buck singled to start the 11th against David Carpenter (0-1). Pinch runner Brett Hayes advanced on a sacrifice, Jose Reyes was intentionally walked and both runners advanced on a wild pitch.

Emilio Bonifacio was then intentionally walked to load the bases, and Ramirez drove a 1-2 pitch over the head of right fielder Travis Buck for the victory.

"I was just trying to hit it hard somewhere," Ramirez said.

The Marlins failed to sweep the three-game series only because they blew a three-run ninth-inning lead to lose Saturday.

"This was a tough series," Astros manager Brad Mills said. "We just have to stay positive and focus on the fact that we've been competitive."

Altuve had two hits and two RBIs for the Astros, but they struck out 11 times and failed to score in the final three innings against Chad Gaudin (1-0).

A bird fell from the closed retractable roof in the eighth inning and landed dead near Marlins center fielder Bonifacio.

"It scared me," he said. "I was getting ready for the hitter and I saw that — boom."

Thus jolted, the Marlins began their comeback in the bottom half of the inning.

The rally cost Houston's J.A. Happ a victory. He allowed two runs in six innings, struck out eight and twice stranded a runner who reached third with one out.

"There were a few times I struggled to get the ball down," he said. "But I was able to make adjustments and hit some spots, especially in a few key situations, so I think I did OK for the most part."

Leading off the 31st inning in the ballpark, Infante hit a milestone homer for the Marlins when he pulled a 1-0 pitch into the second row of the nightclub area beyond the left-field fence. The 73-foot-tall sculpture lit up and squirted water as the artwork's blue marlins rotated.

Gaudin watched from the bullpen.

"It's nice," he said. "It's a good piece of the park. It has got a lot of moving parts to it. It's very entertaining.

"As long as those fish are swimming, that means we're winning."

The ball carried well for Sanchez, too. He was shaken up when he fouled a pitch that bounced and hit him in the right temple. After being checked by the trainer, he lined a triple over the head of center fielder Jordan Schafer — his first extra-base hit in 207 career at-bats.

NOTES: Schafer came out of the game when he hit his head on an infielder's knee trying to steal second base in the 11th inning. His status is day to day. ... With debate ongoing about how well the ball carries in the ballpark, the teams combined for three homers and eight warning track flyouts in the series. ... SS Reyes was charged with his fourth error of the season when he and 3B Ramirez both tried to catch a routine popup that fell in the 11th inning. ... Infante had been 2 for 16 previously against Happ. ... With their first four hits, the Marlins hit for the cycle.