We report on the realization of a quantum sensor based on trapped atom interferometry in an optical lattice for the measurement of atom-surface interactions, with sub-micrometer-level control of the mean atom-surface separation distance. The force sensor reaches a short-term sensitivity of 3.4×10^{-28} N at 1 s and a long-term stability of 4 qN (4×10^{-30} N). We perform force measurements in the 0-300 μm range, and despite significant stray forces caused by adsorbed atoms on the surface, we obtain evidence of the Casimir-Polder force.