If Sunday was Jason Vargas’ Mets finale it can be said he departed Citi Field in much better standing than shortly after he arrived last season.

The veteran left-hander, a trade candidate, has clearly emerged as a dependable back-of-the-rotation piece. The question now is whether the Mets can land anything other than perhaps salary relief by dealing Vargas before Wednesday’s 4 p.m. trade deadline.

For the 15th time in 16 outings he allowed three earned runs or fewer, helping the Mets win their fourth straight, 8-7, to complete a three-game sweep of the Pirates.

Noah Syndergaard, Edwin Diaz and Zack Wheeler are the bigger names the Mets might deal by Wednesday afternoon, but Vargas also remains a possibility for departure. The Mets hold an $8 million option on the pitcher for 2020 (with a $2 million buyout).

Diaz, who has bombed in the closer’s role, added to his unacceptable numbers by allowing a two-run homer to Jose Osuna in the ninth that gave the Mets a scare after Tyler Bashlor scuffled in the inning. But Diaz finally got the two outs needed for his 23rd save.

Vargas (6-5, 4.01 ERA) pitched to disastrous results in the first half of last season after missing part of spring training and rushing to return from surgery to remove the hamate bone in his non-pitching hand. But over his last 25 starts for the club, dating to Aug. 14, 2018, he has pitched to a more than respectable 3.42 ERA.

He lasted 5 ²/₃ innings against the Pirates and surrendered three earned runs on six hits with five strikeouts and three walks. That performance allowed the Mets (50-55) to match their longest winning streak of the season.

The Mets took control for good in the sixth, scoring two unearned runs after center fielder Starling Marte mishandled Michael Conforto’s sinking line drive for an error.

Melky Cabrera smashed an RBI double in the fifth that pulled the Pirates within 6-3 and brought a visit to the mound from pitching coach Phil Regan, but Vargas survived the inning by retiring Adam Frazier.

The Pirates had chipped at the Mets’ six-run lead by receiving a solo homer from Jacob Stallings in the second. The following inning Conforto committed a throwing error attempting to nail Frazier at third base on Stallings’ single. Vargas failed to back up the bag, allowing Frazier to score.

Conforto’s two-run homer was the Mets’ loudest hit of a first inning in which they scored six runs against Chris Archer. Conforto’s homer, his 20th of the season, came after Jeff McNeil was drilled in the right shin leading off.

Archer walked Pete Alonso and Wilson Ramos before Todd Frazier delivered an RBI single. J.D. Davis and Amed Rosario stroked a run-scoring single apiece in the inning before Aaron Altherr — he replaced McNeil atop the lineup as the Mets batted around — made it 6-0 with a sacrifice fly.