Barkley, along with teammate Steve Borthwick, was given the Zurich Premiership Player of the Month award on Wednesday and the 22-year old continued his rich vein of form against Quins.
The young pivot opened his account with a sixth-minute penalty after Quins fly-half Paul Burke sent one wide a few minutes earlier.
Bath, however, were penalised for interference at the line-out not long after and Burke found touch near the corner with a perfectly weighted kick.
The movement from the line-out resulted in a try for flanker Sanderson. Burke added the conversion from near touch to give the Londoners a 7-3 lead after 15 minutes.
Barkley slotted a second penalty soon after, but then flanker Michael Lipman was red-carded for stamping. The Bath pack, however, stood firm.
The fly-half put over another before the break and then immediately after to give his side a four-point lead. Barkley then slotted a long-distance kick in the 54th minute.
Andy Dunne, who had replaced Burke not long after the break, slotted a penalty to close the gap to seven, but Barkley added more heartache for Quins when he put over one in injury-time to leave them without a bonus point.
For Bath:Pens: Barkley 6
For Harlequins:Try: SandersonCon: BurkePen: Dunne