Two-dimensional semiconductors have great potential for beyond-silicon electronics. However, because of the lack of controllable doping methods, Fermi level pinning, and van der Waals (vdW) gaps at the metal-semiconductor interfaces, these devices exhibit high electrical contact resistances, restricting their practical applications. Here, we report a general contact-resistance-lowering strategy by constructing vertical metal-semiconductor-metal memristor structures at the contact regions and setting them into a nonvolatile low-resistance state through a memristive forming process. Through this, we reduce the contact resistances of MoS2 field-effect transistors (FETs) by at least one order of magnitude and improve the on-state current densities of MoTe2 FETs by about two orders of magnitude. We also demonstrate that this strategy is applicable to other two-dimensional semiconductors, including MoSe2, WS2, and WSe2, and a variety of contact metals, including Au, Cu, Ni, and Pd. The good stability and universality indicate the great potential for technological applications.