With the rapid evolution of electric vehicle technology, concerns regarding range anxiety and safety have become increasingly pronounced. Battery systems with high specific energy and enhanced security, featuring ternary cathodes paired with lithium (Li) metal anodes, are poised to emerge as next-generation electrochemical devices. However, the asymmetric configuration of the battery structure, characterized by the robust oxidative behavior of the ternary cathodes juxtaposed with the vigorous reductive activity of the Li metal anodes, imposes elevated requisites for the electrolytes. Herein, a well-designed gel polymer electrolyte with asymmetric structure was successfully prepared based on the Ritter reaction of cyanoethyl poly(vinyl alcohol) (PVA-CN) and cationic ring-opening polymerization of s-Trioxane. With the aid of the sieving effect of separator, the in situ asymmetric gel polymer electrolyte has good compatibility with both the high-voltage cathodes and Li anodes. The amide groups generated by PVA-CN after the Ritter reaction and additional cyano groups can tolerate high voltages up to 5.1 V, matching with ternary cathodes without any challenges. The functional amide and cyano groups participate in the formation of the cathode electrolyte interface and stabilize the cathode structure. Meanwhile, the in situ formed ether-based polyformaldehyde electrolyte is beneficial for promoting uniform Li deposition on anode surfaces. Li-Li symmetric cells demonstrate sustained stability over 2000 h of cycling at a current density of 1 mA cm-2 for 1 mAh cm-2. Furthermore, the capacity retention rate of Li(Ni0.6Mn0.2Co0.2)O2-Li cells with 0.5 C cycling after 300 cycles is 92.2%, demonstrating excellent cycle stability. The electrolyte preparation strategy provides a strategy for the progress of high-performance electrolytes and promotes the rapid development of high-energy-density Li metal batteries.