Updated

(SportsNetwork.com) - The San Francisco Giants were able to end their losing streak before embarking on a 10-game road trip and will open a four-game series against the New York Mets Friday from Citi Field.

Both clubs stood pat before Thursday's trade deadline.

The Giants lost ground in the NL West on their recent homestand, but were able to put the brakes on a six-game losing streak and salvage the finale of a three-game set versus the Pittsburgh Pirates with Wednesday's 7-5 victory.

Gregor Blanco had an RBI single and Joe Panik scored on a passed ball during the seventh inning to help the Giants take a 6-5 lead. The Giants added an insurance run on Pablo Sandoval's single that plated Brandon Crawford in the eighth inning and finished with 12 hits on the night.

Blanco ended with three hits and two RBI, while Michael Morse collected a pair of hits and drove in a run for San Francisco, which sits 3 1/2 games behind the Los Angeles Dodgers for the NL West lead. The Dodgers swept the Giants in three games this past weekend.

"This was a huge game, no question about it. I think we can all eat solid food now for a while," Giants manager Bruce Bochy said. "To play like that at home isn't fun for these guys but they grinded hard today and put the ball in play. A lot of those balls weren't hit hard, but things can happen."

The Giants had scored just six total runs (27-6) during the slide and avoided a three-game sweep at home to the Pirates for the first time since Aug. 10-12, 2007.

Giants starting pitcher Tim Lincecum was roughed up in just 3 1/3 innings of work and allowed five runs and five hits, including two home runs. It was Lincecum's shortest outing as a starter since throwing 3 1/3 innings in back- to-back starts on July 3 and 8, 2012.

The bullpen picked up the two-time NL Cy Young Award winner by keeping the Pirates off the board the rest of the way. Jean Machi was one of five relief pitchers used and earned the win. Santiago Casilla pitched the ninth for his eighth save.

After going 22-9 in their first 31 home games, the Giants have gone just 7-21 by the bay. Now they'll try to stay dominant on the road, where the Giants have won five of the past seven games. San Francisco is 29-20 away from home and will also visit Milwaukee and Kansas City on the journey.

San Francisco has a strong 3.39 earned run average this season and opponents are batting .242 against the club. Ryan Vogelsong hopes to lower his 3.94 ERA when he takes the ball Friday for the Giants and is 5-8 on the season. He hasn't won since June 21 at Arizona, going 0-5 with a 3.448 ERA in that time.

The Giants are 1-5 over the winless stretch for Vogelsong, who was dealt the loss in a 5-0 defeat versus the Dodgers on Saturday and gave up four runs, two of which were earned, in six innings. Vogelsong, a right-hander, is 3-2 in nine road starts and 1-0 with a 3.67 ERA in six career games (4 starts) against the Mets.

New York, meanwhile, took two of three meetings with the rival Philadelphia Phillies to kick off their homestand and recorded an 11-2 beating Wednesday.

After the Phillies pulled within 4-2 in the seventh inning, the Mets exploded for five runs in the bottom half. Lucas Duda, Travis d'Arnaud, Ruben Tejada and Jeurys Familia all produced run-scoring hits for the Mets, who have won six of their last nine games.

"I've been impressed with the consistency with which this team has played the last month or three weeks or however long it's been," Mets third baseman David Wright said. "It seems like we're consistently going out there winning series against some quality teams. Hopefully that continues, because that's what it takes."

Tejada, Juan Lagares and Daniel Murphy all had three hits, with Murphy and Duda providing home runs and three RBI apiece. The 15-hit attack made a winner out of Mets starting pitcher Zack Wheeler and he limited the Phillies to a pair of runs across 6 2/3 innings.

Duda is riding a modest six-game hitting streak, belting four homers and driving in 10 runs over that span. He has knocked in a run in six straight games. Since the All-Star break, Duda is hitting .302 (13-for-43) with five homers, 11 RBI and 11 runs scored.

New York has won four straight home series and is 5-1-1 in its previous seven series overall. The club is 12-4 in the last 16 games at Citi Field.

Taking the mound for the Mets Friday will be Jon Niese and the left-hander is 5-6 with a 3.23 earned run average. Niese last pitched in Saturday's 5-2 loss at Milwaukee and permitted three runs in five innings for his second straight setback. He allowed four runs and 11 hits in six frames of a 5-2 loss at Seattle on July 21.

Niese has a 2-2 mark in eight starts at Citi Field and is 1-2 with a 2.88 ERA in six games (5 starts) lifetime against the Giants.

The Mets were swept in three games at San Francisco from June 6-8 and have lost five of the previous six matchups between the two clubs.