The loss was the third in a row for the Astros, who fell to 16-27 in one-run games.
Lyles (6-7), pitching for the first time since picking up his first career save Monday in Chicago, turned in a quality start by allowing three runs and four hits in six innings. He's 2-1 with a 3.54 ERA in his last three starts.
"I thought he battled," Astros manager Bo Porter said. "He left a couple of pitches up that those guys put good swings on and ended up being the deciding factor in the game, the solo homer and the two-run homer. I felt like he battled and did a good of job of when he left the game we were still in a position to possibly win the ballgame."
The Astros were 0-for-5 with runners in scoring position, with three of those at-bats coming in the sixth inning after Jose Altuve led off the inning with a double. Jason Castro moved him to third with one out, but Matt Dominguez struck out and Brett Wallace flied out to Tal's Hill after a walk.
"We had some opportunities and we didn't do a good job of situational hitting," Porter said. "We got the leadoff double with nobody out, and Jason did a tremendous job moving the runner, and Dominguez wasn't able to deliver with the infield in. He's been clutch all year and gotten big RBIs, and he just didn't get it done that particular time right there."
Wallace crushed the ball in consecutive at-bats, hitting a solo homer to lead off the fifth before hitting the ball to the wrong part of the ballpark in the sixth. He has 12 homers and 24 extra-base hits since he was recalled from Triple-A Oklahoma City on June 25.
"We had a few opportunities to get some runs there, and in those situations you have to do everything you can to try to get some runs in," Wallace said. "You have to tip your cap to them. They made some good pitches when they had to. There were a couple of opportunities we left out there, and those were the ones that we can't afford to give away."
Castro extended his hitting streak to eight games by going 1-for-3 with an RBI double in the fourth inning. He's hitting .360 with a .479 on-base percentage and 1.132 OPS in August, which is the fourth-best in the month in team history behind Carl Everett (1999), Jeff Bagwell (2000) and Ty Wigginton (2008).
But Wallace's homer and Castro's double were the only damage allowed by Mariners starter Erasmo Ramirez, who improved to 5-1 by allowing two runs and five hits in 5 2/3 innings.
"My arm felt great, but I don't know," Ramirez said. "Just the first inning when I tried to throw harder, my body didn't have the normal feeling. I said: 'Hey, I don't have my normal 95 [mph] today, but I just want to work with my location and be aggressive with my 91. Don't worry about it.' If you throw to a spot, it's going to be tough to hit it. Today was like that."
Franklin homered off Lyles with one out in the first inning on a pop fly that found the first few rows of the Crawford Boxes. Gutierrez, who hit a 420-foot double to center field in the second inning, made it 3-0 with a two-run homer to left with one out in the fourth.
"Any home run is tough to take, but overall my ball wasn't getting that down action like I've seen earlier this year," Lyles said. "I had a lot of fly-ball outs. The outfielders did a heck of a job for me out there running down balls. That's due to the fact of a good offensive team putting good swings on it and me not throwing the ball the way I should be throwing it."
Astros rookie reliever Kevin Chapman, who Porter was saving in the last few days to tackle Seattle's left-handed dominant lineup, threw 2 1/3 scoreless innings in relief of Lyles. He hasn't allowed an earned run in 12 consecutive appearances to start his career, which ties the club record held by Tom Martin (1997).
"What he's shown is that he's going to attack when you come into a game," Porter said. "When you come into situations where it's a tight ballgame, you're only going to see this guy one time and it just so happened to get extended today, but I think he does a great job of mixing and matching. He throws his secondary pitches for strikes and he's not afraid to throw his slider and his breaking stuff when he's behind in the count."