Harper hit his 20th homer, Ian Desmond and Kurt Suzuki also connected and the Nationals beat the Philadelphia Phillies 8-4 Wednesday night to move closer toward winning their first division title since moving to Washington.
The Nationals reduced their magic number in the NL East to four, holding a four-game lead over Atlanta with seven remaining.
The 19-year-old Harper joined Tony Conigliaro as the only teenagers to reach 20 homers in big league history.
"That doesn't mean very much to me," Harper said.
Harper was more excited about Werth's in-your-face two-run single in the ninth that extended Washington's lead to 7-4.
Werth, jeered in Philadelphia since leaving the Phillies in free agency after the 2010 season, drew loud boos in the on-deck circle after he picked up a foul ball and faked tossing it into the stands.
The boos grew louder when Werth came up to the plate. Rookie pitcher Justin De Fratus then earned cheers for throwing a fastball high and tight to Werth, who got an earful throughout his at-bat.
Werth got the last laugh with his hit up the middle. Harper added an RBI triple.
"It gave me a chill after the fans were going crazy with all that booing," Harper said. "That was huge. He's been doing that all year for us."
John Lannan (4-0) gave up two runs and five hits in 5 1/3 innings to win his second start since taking Stephen Strasburg's spot in the rotation. Strasburg, the All-Star righty, was shut down after reaching his innings limit.
The Phillies, who closed to within three games of St. Louis for the NL's second wild-card spot following a late push, are on the verge of elimination. The five-time defending NL East champions are 5½ games behind the Cardinals with seven left.
"We've been pushing real hard and it's catching up to us," manager Charlie Manuel said.
Kyle Kendrick (10-12) got roughed up, allowing five runs and five hits in two-plus innings.
Jimmy Rollins hit a solo homer, snapping an 0-for-19 slump. But the Phillies couldn't overcome a 5-0 deficit.
Kendrick walked Werth on five pitches to start the game and Harper drove the first pitch he saw 411 feet to deep left-center for a 2-0 lead. Harper matched the feat of Conigliaro, who hit 24 home runs for the Boston Red Sox in 1964.
"That's nothing new to me," Nats manager Davey Johnson said about Harper. "I saw him hit a 500-foot homer when he was 14 years old. The thing is he thinks he should be hitting .400."
Desmond connected leading off the second, hitting his 25th homer way out to left-center to make it 3-0. Steve Lombardozzi then reached on second baseman Chase Utley's fielding error and Suzuki followed with a shot out to left to put the Nationals up 5-0.
"Any time you can come in here and get a win, it's very satisfying," said Lannan, who improved to 3-12 against the Phillies.
Frandsen hit a two-out triple in the fourth and scored on Rosenberg's single up the middle in his first official at-bat in the majors.
Rollins hit his team-leading 23rd homer off Ryan Mattheus in the seventh.
Roy Halladay felt fine after a bullpen session and will start on Friday for the Phillies. There was a possibility Halladay would be shut down after experiencing spasms near his shoulder blade last week. ... Nationals are 14-4 when Harper goes deep. ... Desmond is 9 for 20 off Kendrick. ... Ruiz received the Mike Schmidt MVP Award given annually by the Philadelphia chapter of the Baseball Writers' Association of America. Cole Hamels got the Steve Carlton MVP pitcher Award, Rollins received the Dallas Green Special Achievement Award and Juan Pierre got the Tug McGraw True Pro Award. ... Gio Gonzalez (20-8) tries to strengthen his bid for the NL Cy Young Award in the series finale against Philadelphia rookie Tyler Cloyd (2-1).