Miley (3-2) allowed one run and three hits, struck out five and walked none as Milwaukee won for the fifth time in the last six meetings with its division rival. The second-place Brewers maintained a 1 1/2-game lead over St. Louis for the top NL wild card.
"I just feel now I can throw strikes," said Miley, who missed 57 games this season with a right oblique injury. "I guess I trust my pitches and trust my catcher, and the defense is playing great.
"I just threw 78 cutters and three fastballs, so it's a 180 (from last season)."
Mike Montgomery (4-5) struggled with his control for four innings, and the Brewers had their way with a succession of Cubs relievers.
Cain had four walks and a double from the leadoff spot, setting the tone for Milwaukee's offense. Christian Yelich walked and added a two-run double in the seventh, reaching base for the 21st straight game -- the longest active streak in the National League.
The first-place Cubs were hurt by poor defense and committed two errors. First baseman Anthony Rizzo left the game with a bruised right foot but said he was OK and would play Wednesday in the series finale.
The Brewers have four games left with the Cubs, including three at Wrigley Field next week, and have their sights set on winning the division.
"This is how we had to start it," manager Craig Counsell said. "So far, so good. Another series win and try to get a sweep tomorrow."
Milwaukee has won 11 of its last 15 games, and Miley said a division title is on the Brewers' minds.
"Why wouldn't we be?" he explained. "We've still got 25 games to go, 23 games to go. Why not? I don't think you quit thinking about it until you can't think about it no more."
Singles by Hernan Perez and Travis Shaw and a sacrifice fly by Erik Kratz gave the Brewers a 2-1 lead in the fourth inning. Cubs second baseman Javier Baez couldn't catch Shaw's hot shot, a play that was initially ruled an error but was later changed to a hit by the official scorer.
Ragged defensive play by the Cubs allowed the Brewers to extend their lead to 6-1 in the sixth. A routine grounder was booted by shortstop Addison Russell, setting up the rally against left-hander Jorge De La Rosa.
The Brewers scored three more in the seventh and two in the eighth. Milwaukee hit three sacrifice flies in the game. Orlando Arcia had three hits and scored three times.
"We did not pitch well at all after we got by Montgomery," Cubs manager Joe Maddon said. "They didn't really beat us up offensively; we just kind of self-destructed."
Cubs: Rizzo exited in the sixth after fouling a ball off his foot in the third. X-rays were negative. ... Veteran LHP Jaime Garcia, signed Friday after being released by Toronto, joined the Cubs. They selected his contract from Triple-A Iowa and recalled outfielder Mark Zagunis, who was placed on the 60-day disabled list with right shoulder inflammation.
New Cubs pitcher Cole Hamels isn't sure the Chicago-Milwaukee rivalry is a full-blown feud on the level of Cubs-Cardinals or Yankees-Red Sox. He said as much after the Brewers' 4-3 comeback victory on Monday.
Hamels, the Cubs starter that day, said, "When you have the majority of Cubs fans in the stands, I don't know if that's a rivalry."
But the fans flocking to Miller Park this week -- for both teams -- may think differently.
"I look at it like we are spending way too much time trying to classify rivalries," Counsell said. "Enjoy the baseball games, man."
The Cubs hold an 81-77 lead in games at Miller Park since 2001 and a 178-167 edge since the Brewers joined the National League in 1998.
"I think that's always going to be part of this series when you play up here; you're always going to get a lot of Cubs fans," Maddon said. "(A huge rivalry is) something that is achieved over time. Give it time and it may eventually show up that way here."
Cubs: LHP Jose Quintana (11-9, 4.21 ERA) allowed five runs over five innings in his last start against Milwaukee, a 7-0 Brewers victory at Wrigley Field on Aug. 14. Prior to that he had given up just five runs in 49 innings vs. the Brewers. Quintana is 3-1 with a 1.32 ERA in five career starts at Miller Park.
Brewers: RHP Jhoulys Chacin (14-5, 3.53 ERA) will make his 30th start of the season. He is coming off a 4-1 victory over Washington on Friday. Chacin is 2-0 in two scoreless starts and 13 innings pitched against the Cubs this season.
More AP MLB: https://apnews.com/tag/MLB and https://twitter.com/AP-Sports
MLB's next big thing: Mauer's Hall of Fame case and more
Joe Mauer is a legend in Minnesota, but is he Cooperstown-worthy? We examine his Hall chances along with other recently retired stars.
With best years behind them, Giants face tough task of starting over
After two losing seasons and with their core players beyond their prime years, the horizon for the champs of 2010, '12 and '14 is bleak.
Japan confident for 2020 Games after win over MLB All-Stars
A 5-1 exhibition series win over the MLB All-Stars has given Japan every reason to be confident about its chances to win its first Olympic gold medal in baseball in 2020.
MVP Betts plans to improve consistency in offseason
Even after winning MVP, Mookie Betts is focusing on improving his offensive consistency in the offseason.
Veteran catcher Jeff Mathis agrees to two-year deal with Rangers
Jeff Mathis, one of the top defensive catchers in the majors, has agreed to a two-year deal with the Rangers, according to The Athletic.
Yelich: 'Unbelievable feeling' being named NL MVP
Christian Yelich joins SportsCenter after being named the National League MVP and receiving 29 of 30 first-place votes.