Ferrer, the top-ranked Spaniard in New York in the absence of the injured Rafael Nadal, saw off 13th-seeded Frenchman Gasquet in two hours and 54 minutes of playing time.
But two lengthy rain delays meant the tie, which started shortly after 1:15 p.m. local time, did not finish until just before 8:30 p.m.
Fourth seed Ferrer will face either Serb eighth seed Janko Tipsarevic or Philipp Kohlschreiber, the German 19th seed, for a place in the semi-finals.
“The rain made it very difficult,” said Ferrer. “But the fans have been great and I wanted to win it for them.”
The 30-year-old Ferrer took a 7-1 career lead over Gasquet into the last-16 tie, having also triumphed at the same stage at the Australian Open this year.
He made that 8-1 on a fifth match point on a damp and humid Louis Armstrong Stadium. Ferrer was a semi-finalist in New York in 2007.