Lyles (5-12) benefited from a trio of double-plays while giving up just four hits with a walk. He struck out three.
The 21-year-old right-hander also launched a solo shot in the fifth inning, joining Fernando Martinez, Jed Lowrie and Matt Dominguez in belting long balls.
Brewers starter Mike Fiers (9-10) struck out 10 over six innings but couldn't prevent Milwaukee from being officially eliminated from the National League playoff hunt.
Police: Sword-wielding man demanded free tacos
Puzzle-maker slips 'Murdoch Is Evil' into Rupert Murdoch's Sunday Telegraph