The Dodgers won for the 10th time in September and moved back within a game of .500 in a bid to have at least a break-even season in what has been a year filled with distractions.
Loney hit a three-run homer in the first inning and Rivera had a two-run blast in the third to make a winner out of starter Ted Lilly.
Lilly (10-14) gave up a run on four hits over seven innings. He had won only two of his previous eight starts.
Kenley Jansen escaped a bases-loaded jam in the eighth to keep the Los Angeles lead safe.
James McDonald (9-9) lasted only three innings in taking the loss. He gave up five runs on seven hits.
Notable deaths of 2014 [PHOTOS]