SEATTLE (AP) — It took more than five hours, but the Houston Astros finally put away the pesky Seattle Mariners.

Rookie Myles Straw led off the 14th inning with a triple and scored on Yuli Gurriel's sacrifice fly, and the Astros outlasted the Mariners 8-7 Thursday night in the longest game of the season by innings for either team.

Seattle staged tying rallies in the ninth and 10th innings and loaded the bases in the bottom of the 14th thanks to three walks by Chris Devenski (1-0), but the right-hander got Shed Long to fly out to end it.

"All's well that ends well," Astros manager AJ Hinch said.

Houston led 5-1 after 6 1/2 innings but Seattle chipped away, tying it at 6 in the ninth on Edwin Encarnacion's single against closer Roberto Osuna, his first blown save of the season. That prevented Justin Verlander from becoming the first 10-game winner in the AL.

"That was not a game that was expected, given how it started," Hinch said. "And even halfway through nine innings, it felt like we were completely in control of it. Then it was like a game that was never going to end. Quite a game."

Verlander was pulled with one out in the sixth after giving up three singles. He was charged with three runs on five hits.

"From the get-go today it was a little bit touch and go for me," Verlander said. "I wasn't my best today and we made the pull. I wasn't surprised. In some of these games like this one, it comes down to pure will, who wants it most."

Josh Reddick's sacrifice fly as a pinch-hitter in the 10th gave the Astros to a 7-6 lead before Omar Narváez tied it with his ninth homer of the season.

Matt Festa (0-1) allowed Straw's triple — a ball that was played poorly by right fielder Domingo Santana — and one walk in the 14th for the Mariners.

Seattle outfielder Mitch Haniger left in the seventh with what the team called a "mid-body" contusion.

The Astros took three of four in the series and are 9-0-1 in their last 10 series.

Austin Adams started as an opener for Seattle and couldn't get through the first inning. He gave up three runs, three hits and two walks, including a two-run homer to Robinson Chirinos, before being replaced by Tommy Milone.

Chirinos has homered in four consecutive games, tying Cliff Johnson's club record from 1975 for longest streak.

Alex Bregman's 18th homer gave Houston took a 4-1 lead in the fifth. Rookie Jack Mayfield hit his first career homer in the seventh inning to make it 5-1.

The Mariners rallied for three runs in the seventh inning on five singles. After Houston added a run in the eighth, the Mariners scored again in the bottom of the inning before Osuna entered.

"It's kind of hard to be focused the whole game," Narváez said. "But we did a good job swinging the bats. Remember, we were facing a pretty good team. They don't strike out much and put the ball in the play almost every time."

TOP 20

Verlander moved ahead of Hall of Famer Mike Mussina for 20th on the career strikeout list, fanning seven to reach 2,816.

TRAINER'S ROOM

Astros: Hinch doesn't expect OF George Springer or 2B Jose Altuve to return for the upcoming eight-game homestand because both players will need to go on rehab assignments before coming off the injured list. Springer (left hamstring strain) was placed on the 10-day IL on May 25 and Altuve (left hamstring strain) has been on the IL since May 11.

Mariners: RHPs Felix Hernandez and Hunter Strickland both threw bullpen sessions. Strickland will throw again Sunday before starting a rehab stint in Triple-A Tacoma next week.

UP NEXT

Astros: RHP Gerrit Cole (5-5, 3.94) will make his 13th start of the season when the Astros host the Orioles on Friday. RHP Gabriel Ynoa (0-2, 5.06) is expected to start for the Orioles. Cole leads the AL with 116 strikeouts, averaging 13.4 per nine innings.

Mariners: LHP Marco Gonzales (5-6, 4.89) will start as the Mariners open a three-game series in Anaheim. LHP Andrew Heaney (0-0, 4.09) will start for the Angels. Gonzales is coming off a season-worst performance, allowing 10 earned runs, nine hits and three walks in 4 2/3 innings against the Angels on June 2.