The second straight victory for the Phillies over the Giants in a matchup of division leaders featured a benches-clearing shoving match in the sixth inning.
Philadelphia won its eighth straight game, getting a seven-inning effort out of Vance Worley (8-1).
Victorino hit a solo shot in the fourth and Mayberry had a two-run blast, helping Philadelphia build a 5-2 lead heading into the sixth.
When Victorino came up again in the sixth he was hit in the back by a pitch thrown by reliever Ramon Ramirez. Victorino took a step toward the mound and Ramirez threw down his glove, bringing players from both teams onto the field.
No punches appeared to be thrown, but Victorino, Ramirez and San Francisco catcher Eli Whiteside were ejected from the game.
Philadelphia went on to score three times in the sixth, two of the runs coming in on a single by Jimmy Rollins. Recently acquired Hunter Pence added a homer for the Phillies in the seventh.
Worley allowed two runs on seven hits and struck out six.
The loss went to Jonathan Sanchez (4-6), who surrendered five runs on seven hits in 4 2/3 innings.