Jerry Sands collected three hits for Los Angeles, which has won three of its last four games. Ted Lilly (10-14) gave up one run on four hits with two walks and seven strikeouts over seven innings to reach double digits in wins for the ninth straight season.
"I was throwing pitches for strikes," Lilly said. "It's hard for me to feel satisfied when I knew I could have done better. It was a fun game."
Josh Harrison knocked in the lone run for the Pirates, who have dropped seven of nine. James McDonald (9-9) surrendered the home runs to Loney and Rivera among seven hits in three frames.
"He was very effective," Pittsburgh manager Clint Hurdle said of Lilly.
The Dodgers jumped out to a 3-0 lead in the first inning on Loney's 11th home run of the season, a two-out blast to right-center.
Los Angeles extended its lead to 6-1 when Tim Federowicz singled home Aaron Miles in the fifth.
The Dodgers are 5-2 against Pittsburgh in 2011...McDonald broke into the majors with the Dodgers in 2008 and was dealt to the Pirates at last year's trade deadline for reliever Octavio Dotel.