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
Who is baseball's real home run king?
We break down the cases for why you might crown Barry Bonds, Hank Aaron or Babe Ruth.
MLB third baseman tiers: Hot corner high on franchise-caliber talent
The third base position is loaded with young All-Stars, including several who have yet to hit their prime years.
Tebow advised Murray to follow his heart, passion
Tim Tebow reveals the advice he gave to Kyler Murray in regards to deciding between baseball and football.
Tebow: The AAF keeps calling me
Tim Tebow says that the Alliance of American Football keeps calling him to play, but insists he is committed to playing baseball.
Tebow: This is the biggest spring training for me
Tim Tebow expects spring training with the Mets to be smoother than last year's because he's more adjusted to his transition to baseball.
Kurkjian's favorite spring training stories
Tim Kurkjian expresses his love for spring training and his favorite memories from covering it for 38 years.