The Royals' Billy Butler smacked a solo homer in the eighth inning to forge a 4-4 tie, sending the contest into extra frames.
After Butler struck out, Eric Hosmer singled to load the bases and Cain coaxed another base-on-balls from Miller, forcing home the decisive run.
The rally made a winner of Kelvin Herrera (2-2), who fired two innings of shutout relief, and Greg Holland racked up his fifth save as the Royals followed up a 4-2 win in Game 1 with another triumph in the nightcap.
Mike Napoli went 3-for-5 with a bases-empty homer and two RBI for the Red Sox.
Ohio crash that killed two caught on camera [VIDEO]
Megyn Kelly: Santa Claus and Jesus are both white men