The Padres finished the night a half game behind the Giants, behind Richard's eight-hit complete game and four RBI by Ryan Ludwick.
The loss officially eliminated lame-duck Manager Joe Torre and the Dodgers from playoff contention.
Richard (13-8) struck out six and walked two in ending a personal three-game losing streak.
Chad Billingsley (11-11) took the loss after giving up five runs on six hits over five innings. Billingsley struck out six, but he also hit two batters in San Diego's three-run sixth inning.
Ludwick was 1-for-4 had a two-run single in the sixth inning. He drove in his other runs by being plunked by Billingsley in the sixth and on a fielder's choice in the ninth.