Rivers went 24-of-33 through the air for 240 yards and Ryan Mathews carried the ball 20 times for 114 yards for San Diego (6-7), which remained two games behind Denver in the AFC West.
The Chargers raised their December record under Coach Norv Turner to 17-2 thanks mainly to Matthews, who grabbed six passes for 34 yards to go with his third straight 100-yard-plus rushing performance.
Gates finished with seven grabs for 68 yards.
The reeling Bills (5-8), meanwhile, fell from playoff contention with their sixth straight loss.
Ryan Fitzpatrick managed only 13-of-34 in passing efficiency, good for 176 yards with two interceptions.
Notable deaths of 2014 [PHOTOS]