Joakim Soria started the eighth for the Royals and Logan Forsythe greeted him with a single before Kevin Kiermaier drew a walk. After Evan Longoria struck out swinging, Miller hit a 1-1 pitch into the right-field stands to put the Rays in front.
Alex Colome pitched a scoreless ninth to earn his 26th save.
Alex Gordon gave the Royals a 2-0 lead in the fourth when he homered with a man aboard against Rays starter Drew Smyly with two outs.
Smyly surrendered just those two runs in seven innings in a no-decision.