Bonds moved within five of tying Hank Aaron's record, an inning after getting a startling hug from a fan in a 4-3, 10-inning loss to Arizona. Miguel Montero hit a solo homer off Brad Hennessey (1-3) in the 10th for the Diamondbacks and San Francisco lost its third straight.
Meanwhile, the Astros hit a walk-off home run for the second straight night off Colorado Rockies closer Brian Fuentes in a 9-8 victory.
"Everybody in that clubhouse knows he's going to get a lot of attention reaching this milestone, as he should," Giants manger Bruce Bochy said. "It's going to be a big moment in baseball. Right now, we're all embarrassed with where we're at, how we're playing, things that are happening on the field."
The 42-year-old Bonds led off the eighth inning with a solo shot off D-backs starter Livan Hernandez to tie the game at 3. Watching the ball sail over the wall in right-center, he lowered his head and began his trot. The main center-field scoreboard immediately featured a road sign reading "Bonds 750" in the middle and "Road to History" on either side.
The home run came an inning after a fan gave everybody a scare when he hopped the fence and ran out to Bonds in left field. The seven-time NL MVP calmly greeted the man and walked him off and into the custody of security personnel.
The fan came out over the short fence along the left-field line and scurried to Bonds while Orlando Hudson was batting. Bonds didn't flinch, putting his arm around the man and walking him off the field _ and fans began chants of "Barry! Barry!"
"He just wanted to shake my hand," Bonds told MLB.com while quickly leaving the ballpark. "I told him to come with me so he didn't get into any more trouble."
The Giants said the man, in the custody of San Francisco police, would face charges of public drunkenness and interfering with a sporting event. His name and age were not immediately available.
Bochy credited Bonds for not panicking.
"My first feeling was fear," said center fielder Dave Roberts, who began to move toward Bonds. "Barry handled it like a pro. I'm glad the situation was diffused."
In other NL games, New York swept a doubleheader from Philadelphia, 6-5 and 5-2; Chicago 6, Milwaukee 5; Pittsburgh 3, Washington 2; Atlanta 12, Florida 3; St. Louis 4, Cincinnati 2; and San Diego 7, Los Angeles 6.
It was the fourth blown save in eight days for Fuentes, and the Rockies have lost eight straight.
With two outs, Fuentes (0-4) walked Carlos Lee, who hit a grand slam in the 11th off Fuentes on Thursday night. Loretta followed, homering to the Crawford Boxes in left for his second home run of the season.
The Astros are the first team to win consecutive games with walk-off home runs since Tampa Bay did it on May 19-20, 2006, according to the Elias Sports Bureau.