Ruf drew a bases-loaded walk and Frandsen followed with a run-scoring groundout for a 2-0 lead, and the Phils went on to even their three-game series.
Starter Zach Miner lasted four innings, allowing one run, and Michael Stutes (3-1) pitched a scoreless fifth to pick up the victory.
J.C. Ramirez and Jacob Diekman combined for three scoreless relief innings and Jonathan Papelbon finished up with his 29th save to secure the win.
Marlins starter Henderson Alvarez (4-6) was tagged with the loss, surrendering a pair of runs on five hits over seven innings.
Justin Ruggiano drove in Miami's only run.
Wisconsin business offering 'therapeutic cuddling' forced to close
Police: Sword-wielding man demanded free tacos