Harper homered the second pitch of his first at-bat to announce his return from the disabled list, beginning a bad day for Gallardo who allowed eight runs on nine hits and three walks in three-plus innings.
Werth knocked in five on two hits, while Jordan Zimmermann had two runs and three hits as well as earning his 12th win for his six innings of four-run ball.
Andy Pettitte set the all-time New York Yankees record for strikeouts but had to settle for a no-decision in a 10-4 win over the Minnesota Twins.
Pettitte fanned just two in five innings of four-run ball, but that was enough to take him to 1,958, one ahead of Whitey Ford.
Robinson Cano hit home runs in the first and third innings, before the Yankees piled on seven in the last two frames to seal the win.
Rookie Jose Fernandez struck out 10 in eight scoreless innings to lift the Miami Marlins to a 4-0 win over the San Diego Padres.
Fernandez allowed just two hits and a walk, while Jeff Mathis clubbed a three-run double.
Jose Reyes and Mark DeRosa both went yard as the Toronto Blue Jays celebrated Canada Day with an 8-3 victory over the Detroit Tigers.
Todd Frazier homered and drove in four as the Cincinnati Reds saw off the San Francisco Giants 8-1 in a match shortened to six innings by rain.
Ryan Roberts hit a pair of long balls and Matt Moore fanned nine in seven shut-out frames as the Tampa Bay Rays overwhelmed the Houston Astros 12-0.
Andrew Brown singled in a pair to seal a walk-off 5-4 victory over the Arizona Diamondbacks after the New York Mets rallied from three runs down to win in 13 innings.