SAN FRANCISCO (AP) Through good-natured dugout banter and players sticking together, Chip Hale watched his Arizona Diamondbacks come together on this winning road trip that began with a little rough patch.
Yasmani Tomas hit a go-ahead home run in the fourth, Paul Goldschmidt drove in two runs, and the D-backs beat the San Francisco Giants 6-2 on Thursday for a four-game sweep.
Tyler Wagner (1-0) allowed two hits in five relief innings of Shelby Miller for his first major league win, helping Arizona wrap up a 7-3 road trip with a fifth straight win and first four-game sweep ever in the Giants' 17th-year ballpark and fifth of three or more games.
''It's not easy to sweep anybody four games at the major league level, especially a team like that in this ballpark. I'm very proud of our guys,'' Hale said. ''Guys kind of bonded.''
The benches cleared and both teams were warned in the eighth after Josh Osich hit Arizona's David Peralta with a pitch for the second straight day. Peralta walked toward the mound and offered Osich a few words, but there were no ejections.
Peralta said he didn't think Osich was trying to hit him but was more annoyed it happened again.
''That's my thought. He showed me yesterday like he can't even throw the pitch inside because he ended up hitting me twice,'' Peralta said. ''The first pitch he hit me was at my face. I got lucky that I threw my arm in. Today he did the same thing and got me on my elbow. That's why I said something, like: `Hey, what's going on? You're going to hurt somebody.'' He's not like throwing 88, he's throwing 98.''
Osich said afterward: ''I can see why he can be mad. I can see what it looks like because it's the second day in a row. It's part of baseball. I missed my spot.''
Jake Lamb went 7 for 15 with a homer, triple and four doubles during the series with two more hits in the finale against Johnny Cueto (3-1), who was tagged for his first loss since joining the Giants on a $130 million, six-year contract.
Lamb's 16 total bases were the second most in a single series at AT&T Park behind Matt Williams' 17 during a five-game set from Sept. 21-25, 2000.
Jean Segura added a two-run triple in the ninth as Arizona won for the eighth time in the last 10 against San Francisco and 12th in 14 at AT&T Park, including six shutouts.
The Giants, who began the season as an NL West favorite, are searching for answers - and clutch hitting - after losing their fifth straight and eighth in nine. They are 3 for 35 with runners in scoring position during the skid.
Miller's short day was done after he walked four straight batters to begin the third. He missed a chance for his first win a day after Zack Greinke earned his first victory since joining the D-backs on a $206.5 million deal in December.
Miller threw six straight balls, walking Cueto, leadoff man Denard Span, Joe Panik and Hunter Pence to force in San Francisco's first run. Brandon Belt's double-play groundout tied it.
The five walks by Miller were his most in 26 starts since six with Atlanta at Arizona last June 2.
''I feel like I'm just mechanically off,'' Miller said.
Home run king Barry Bonds returns to the ballpark he helped get built in a different uniform for the first time since leaving the Giants following his record-setting 2007 season.
Bonds visits the Bay Area as the Miami Marlins' hitting coach for a weekend series against the Giants starting Friday night.
The slugger and seven-time NL MVP posted on Twitter last week: ''Truly blessed to inspire people from all over! Miami has welcomed me with open arms.''
Diamondbacks: RHP Josh Collmenter, who hasn't pitched this year because of inflammation in his throwing shoulder, will begin pitching in games at extended spring before joining a minor league club to continue his return and work up to three innings over about 10 days. Manager Chip Hale hopes he will come off the disabled list in early May.
Giants: C Buster Posey had the day off following a night game, with Trevor Brown drawing the assignment of catching Cueto. Posey had already played a lot this week. ''I don't want to wear him down in April,'' manager Bruce Bochy said. ... Former Giants RHP Tim Lincecum, still throwing as part of his rehab from left hip surgery, is yet to schedule his showcase pitching session for scouts and team executives, his agency said.
Diamondbacks: LHP Patrick Corbin (1-1) starts against the Pirates for the second time in his career as Arizona returns home for 10 games.
Giants: RHP Jeff Samardzija (1-1) makes his home debut, pitching the series opener against the Marlins.