The adoption of lithium metal anodes, which are ideal for constructing batteries with high specific energy, is limited by dendrite growth and poor cycle performance. Herein, an anion-regulated solid polymer electrolyte based on in-situ-polymerized poly(ethylene glycol ether acrylate) is prepared for dendrite-free lithium metal batteries. According to the space-charge theory, the growth of lithium dendrites is effectively inhibited by the improved electric field of solid polymer electrolyte on the lithium anode side. And this solid system achieves a lithium transfer number of 0.63, excellent ionic conduction on 2.16 × 10−5 S cm−1 at room temperature), a wide electrochemical stable window (4.8 V vs. Li+/Li) and excellent cycle performance. The flexible batteries (LiFePO4 cathode/solid polymer electrolyte/lithium metal) are assembled to power a light-emitting diode at room temperature. We highlight the anion regulated polymer solid electrolyte, which shows great potential for solid lithium metal batteries and flexible batteries.