In-form David belted 102 off 73 balls as Surrey cruised to the 243 needed with more than seven overs remaining.
David also picked up two early wickets with his off spin before George Scott and Tom Smith’s record stand helped Gloucestershire rally to 242 for seven.
Surrey will now face Durham on Tuesday for a place in Thursday’s final.
David came into the match in fine form after hitting 140 not out in beating Warwickshire and an unbeaten 52 to see off Derbyshire in the space of three days.
He came in with Surrey wobbling on 24-2, after the loss of Mark Stoneman (18) and Ollie Pope for one, but quickly stamped his authority.
Chief scores
Gloucestershire: 242/7 (Scott 66 n.o, Smith 51 n.o, Moriarty 2/30, David 2/32)
Surrey: 246/5 (David 102, Smith 69 n.o). (BBC)