Yasiel Puig hit a three-run homer and Brett Anderson went six solid innings as the Dodgers beat the Phillies to remain two games ahead of the Giants.