The Reds (43-28) hit four solo homers in all, extending their best start since 1995, the last time they won a playoff series. The win also kept Cincinnati in second place in the NL Central, a game and a half ahead of the Pirates.
Cozart connected on a hanging slider in the fourth and Frazier hit a down-the-middle fastball in the sixth off Liriano (5-3), who hadn't allowed a homer in his seven previous starts. He opened the season on the disabled list, recovering from a broken right arm last December.
During a game in Pittsburgh this season, Liriano tied up Frazier with a fastball. He had that in mind when he came to bat and got one on the first pitch.
"That one felt pretty good," Frazier said. "He tried to get one past in Pittsburgh and I got enough of it to get a single. I was looking for it, and got my (front) foot down sooner and got some good wood on it."
Mike Leake (7-3) extended the best stretch of his four-year career, giving up six hits -- including Russell Martin's RBI double -- in seven innings. Leake got 13 outs off ground balls and fanned three.
"He's pitching with confidence and pitching a little harder," manager Dusty Baker said. "He just goes about his business with no fanfare. There's no difference in his personality."
The right-hander is 5-1 in his last seven starts with a 1.15 earned run average, showing why the Reds made him their first-round pick in the June 2009 draft.
"He's been doing this for three months now and building up to this," Pirates manager Clint Hurdle said. "That's a guy that can pitch. That's what he's evolved into. He pitched as well as I've ever seen him."
With seven wins, Leake is only five shy of his career high from the 2011 season. He went right to the majors after the Reds drafted him out of Arizona State, going 8-4 as a rookie.
"I'm a little bit more motivated," Leake said. "I think my head's back in college, pitching-wise, and I'm thinking a little better."
Tony Cingrani made his first relief appearance this season and pitched out of a two-on threat in the eighth, fanning Pedro Alvarez to keep the score 2-1. Cingrani joined the rotation when Johnny Cueto went on the disabled list, and the Reds kept him around with Cueto back so they'd have another left-hander in their depleted bullpen.
Aroldis Chapman pitched the ninth for his 18th save in 20 chances, walking one and fanning two.
The Ohio River rivals have occupied the second and third spots in the NL Central most of the season, staying right behind the torrid Cardinals. The Pirates have gone 4-2 against the Reds at PNC Park, where they've won 25 games overall, tied with Cincinnati for most home wins in the majors.
It's their first visit of the season to Cincinnati. The Pirates went only 3-6 at Great American Ball Park last season, unable to take advantage of its hitter-friendly dimensions.
Liriano gave up Cozart's seventh homer in the fourth inning, extending the shortstop's hitting streak to seven games. Frazier hit his ninth homer in the sixth inning for a 2-1 lead, a drive that also landed in the upper deck in left field and was estimated at 443 feet.
Several nice defensive plays also helped to keep it close.
Starling Marte made a diving, backhand catch of Brandon Phillips' slicing line drive to left field in the third inning, forcing the Reds to strand a runner at second base. Cozart turned a couple of tough-hop grounders into outs, preventing the Pirates from threatening in the early innings.
Marte was back in the lineup batting leadoff. He was out of the lineup the last four games with a strained left oblique. ... RH A.J. Burnett, who went on the 15-day DL last Thursday with a strained right calf, won't do much for the next three days. ... LH Wandy Rodriguez, on the DL with a sore left forearm, threw in the bullpen on Monday. He's eligible to be activated on Friday. ... Reds OF Chris Heisey started a rehab assignment at Triple-A Louisville. He's been on the DL since April 29 with an injured right hamstring. ... NASCAR drivers Bobby Labonte and Kevin Harvick threw ceremonial pitches. Hits king Pete Rose watched the game from behind home plate. He attends several games a season in his hometown.