Harper also became the first player in the National League to hit 30 home runs this season. Seven American League players have hit at least 30 homers.
Harper homered in the bottom of the fifth inning. With two runners on base and the Nats down, 6-2, Harper swung at the first pitch from Giants right-hander Matt Cain and hit a monster shot in Levi's Landing in right-center field to make it a 6-5 game in favor of San Francisco.
Asked if hitting 30 home runs was a big deal to him, Harper made it clear he expects more.
"I'm playing for 40 [home runs]," Harper said. "If you are not worried about 30, you are not worried about 40. I want to hit 40 or 50. I want to keep going. I want to keep battling.
"If I'm doing that, hopefully, we are winning ballgames. That's all that matters. Personal stats, of course, are fun. But it's all about winning ballgames and what you can do for your team."
Manager Matt Williams said Harper hasn't reached his ceiling as a player.
"[Harper] has taken the steps necessary to be the player he wants to be. That ceiling is pretty high. He has a long way to go still," Williams said.
Bill Ladson is a reporter for MLB.com and writes an MLBlog, All Nats All the Time. He also can be found on Twitter @WashingNats. This story was not subject to the approval of Major League Baseball or its clubs.