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
How the Phillies can be smart spending stupid amounts of money
The Phillies have plenty of payroll space and expectations of contention to deliver on. Here's a plan for which top free agents they should target.
Buster's Buzz: A checkup on the state of baseball
A new TV deal and strong attendance don't jibe with complaints about the changing game. What are the strongest indicators of the sport's health?
Astros acquire Aledmys Diaz in trade with Blue Jays
The Astros, who could lose Marwin Gonzalez to free agency, acquired infielder Aledmys Diaz, who hit a career-high 18 homers last season, in a trade with the Blue Jays.
Dodgers closer Kenley Jansen set for Nov. 26 heart surgery
Dodgers closer Kenley Jansen is expected to be ready for spring training after surgery to correct his irregular heartbeat. The surgery, which had been expected, has been scheduled for Nov. 26, with recovery time anywhere from two weeks to eight weeks.
Red Sox re-sign Series MVP Steve Pearce on 1-year, $6.25M deal
World Series hero Steve Pearce will be back in a Red Sox uniform in 2019. Boston re-signed the journeyman 1B for a reported $6.25 million. "We all saw what kind of impact he can have," GM Dave Dombrowski said of the improbable World Series MVP.
Rangers hire Julio Rangel to handle pitching staff
Julio Rangel has been hired by the Texas Rangers as pitching coach for new manager Chris Woodward.