Current X-ray observations and simulations show that gravitational lensing can be used to infer the structure near the event horizons of black holes, constrain the dynamics and evolution of black-hole accretion and outflows, test general relativity in the strong-gravity regime and place constraints on the evolution of dark matter in the lensing galaxies. These science goals currently cannot be achieved in a statistically large sample of z = 0.5 - 5 lensed quasars due to the limited capabilities of current X-ray telescopes and the relatively low number (~200) of known lensed quasars. The latter limitation will be resolved with the multi-band and wide-field photometric optical survey of LSST that is expected to lead to the discovery of > 4,000 additional gravitationally lensed systems. As we show in this white paper, these science goals can be reached with an X-ray telescope having a spatial resolution of <0.5arcsec to resolve the lensed images and a collecting area of >0.5 m^2 at 1 keV.