Neither player was able to claim a decisive break of serve during the opening set and as a result a tie-break was required to determine a victor.
The breaker was equally tight, but it was South African Anderson who eventually broke to emerge a 7-5 winner.
Gasquet, playing in front of a home crowd, responded positively in the second set. On this occasion he did manage to break world number 37 Anderson, while holding his own service games to take the set 6-4.
That success for Gasquet sent the match into a deciding third set. However, world number 12 Gasquet was unable to get a foothold against Anderson, who won five games in succession.
Gasquet then momentarily reduced the arrears to four games, but Anderson held his serve in the next game to advance through with a 6-1 triumph.
He will now take on number five seed Tomas Berdych in round three.