Trailing 6-1 entering the inning, the Phillies sent 11 men to the plate, scoring six times to stun Milwaukee with a late-inning rally for the second straight game.
Philadelphia tallied four times in the ninth inning Monday to defeat the Brewers by an identical 7-6 score.
Erik Kratz socked a pinch-hit two-run homer with one out off Manny Parra to begin the rally. After Parra walked the bases loaded with two down, Ruiz lined a pitch off Kameron Loe (4-4) into the left-center field gap, chasing home all three runners to forge a 6-6 tie.
The next batter, Hunter Pence, then singled home Ruiz to complete the rally, which allowed the Phillies to clinch their first home series since late June.
The comeback made a winner of Michael Schwimer (1-1) while Jonathan Papelbon corralled his 22nd save for Philadelphia.
Brewers starter Zack Greinke yielded only one run on three hits over seven innings.