Prado went 4-for-5 with four runs scored while Goldschmidt (3-for-6) blasted his 30th round-tripper of the year, tying him with Pittsburgh's Pedro Alvarez (who also delivered a three-run shot in the game) for the National League lead.
Cahill (4-10) collected his first victory since May 17, allowing four runs on seven hits over five innings. He walked one and struck out four.
Pirates starter Jeff Locke (9-4) was roughed up for eight runs on 10 hits, lasting just 2 2/3 innings.
Starling Marte went deep and Andrew McCutchen went 3-for-4 with a run scored for the National League Central-leading Bucs, whose lead over second-place St. Louis was cut to two games.