The loss spoiled a breakout game for Bruins rookie Phil Kessel, who enjoyed the first two-goal game of his career, in only his fifth game back since having surgery for testicular cancer.
Daniel Paille scored twice, including an empty-net goal in the final minute, to help the Sabres snap a season-worst three-game winless streak (0-2-1). Thomas Vanek and Derek Roy also scored as Buffalo also ended a three-game home losing skid.
Glen Murray also scored for the Bruins, who settled for a split of the home-at-home series after a 3-2 shootout win over the Sabres at Boston on Monday. Boston dropped to 2-6-1 in its last nine games and has lost five straight on the road - the team's worst stretch since going 0-5 in the final month of last season.
The Eastern Conference-leading Sabres (32-11-4), who allowed the Bruins to tie the game twice, rallied with their best offensive outing in 11 games - dating to a 6-3 win over Washington on Dec. 26.
Campbell put the Sabres up 4-3 with 9:55 remaining, when his rising shot from the right point appeared to deflect off someone in front and sailed past screened goalie Tim Thomas.
Afinogenov then sealed it 3:39 later, capping a great individual effort when he streaked past defender Andrew Alberts at the Bruins' blue-line, cut to the net and backhanded a shot in.
Kessel, otherwise, was the star. He opened the scoring on a breakaway 10 minutes in and then tied the score 3-3 in the opening minute of the third, when he one-timed Marc Savard's cross-ice pass. The 2006 first-round pick missed 11 games and had not produced a point since he returned.
He now has seven goals on the season.
Sabres goalie Ryan Miller stopped 25 shots, his best stop coming with eight minutes left when he kicked out his right pad to stop Brad Stuart's blast from the right circle.
Notes: Boston was without C Wayne Primeau, who hurt his shoulder against the Sabres on Monday. D Bobby Allen, called up from AHL Providence on Tuesday, made his Bruins debut while playing only his second NHL game, and first since Dec. 31, 2002, when he was with Edmonton. ... Sabres LW Jochen Hecht, out for at least a week, missed his first game since sustaining a lower body injury on Monday. ... Sabres co-captain Daniel Briere had two assists to give him a single-season career high 38.