Santana (8-6) logged his third victory in four starts, holding the Mets to five hits and three walks while striking out five. The right-hander has allowed only four earned runs over 28.1 innings since the All-Star Game break.
The Royals were clinging to a 1-0 lead in the fifth when they erupted for three runs, capped by Cain's slicing two-run single to right field.
Mike Moustakas went 2-for-4 with a solo homer while Eric Hosmer added two hits with an RBI as the Royals took two-of-three games from New York.
Zack Wheeler (4-2) absorbed the loss, surrendering four runs (three earned) on five hits over five full innings.
Eric Young and John Buck each drove in a run for New York.