Lyles (4-11) allowed two hits and struck out five to earn his third win since June 26, and Wilton Lopez picked up this fourth save after stranding two Chicago runners on base in the ninth.
Jason Maxwell drove in the only run of the game with a sacrifice fly in the third inning.
The Astros were outhit by the Cubs 6-4 and committed four errors to Chicago's two miscues.
Justin Germano (2-7) allowed only one unearned run on three hits and eight strikeouts over five innings, but wound up with the loss. The Cubs came into the game with a season-high four-game winning streak.
Chicago first baseman Anthony Rizzo left the game after colliding with Maxwell in the third inning and was listed as day-to-day. Rizzo appeared to hyper-extend his left leg and was also kicked in the leg and then fell on his right shoulder while trying to beat out a ground ball to second.