Solar energy generation and storage are two distinct processes and integrating them in a single device is of great challenge. Herein, BiOCl hydrogel film electrode featuring excellent photocorrosion and regeneration properties acts as the anode to construct a novel type of smart Solar-Metal-Air Batteries (SMABs), which combine the characteristics of solar cell (direct photovoltaic conversion) and metal-air battery (electric energy storage and release interacting with atmosphere). The cyclic photocorrosion processes between BiOCl (Bi3+) and Bi can simply be achieved by solar light illuminating and standing in dark, corresponding to the charging and discharging processes of the battery, respectively. Upon illumination, the device takes open-circuit configuration to charge itself from the sunlight. Photogenerated electrons in the conduction band of BiOCl reduce Bi3+ to Bi0 following the photocorrosion process of BiOCl; and in the meantime, photogenerated positive charges (holes) initiate the oxygen evolution reaction to produce O2. Notably, in this system, the converted solar energy can be stored in the SMABs without the need of external batteries to store the electricity like those for the traditional solar cells. In the discharging process in the dark, Bi0 spontaneously turns back to Bi3+ producing electrons to induce oxygen reduction reaction occurring at the counter electrode (Pt/C) like metal-air battery. With an illumination of 15 min, the battery with an electrode area of 1 cm2 can be continuously discharged for approximately 3,000 s, demonstrating a theoretical capacity of 384.75 mAh·g− 1, which is higher than the theoretical capacity of lithium-ion batteries (LiCoO2, 274 mAh·g− 1). This novel type of SMABs is developed for the first time based on the unique photocorrosive and self-oxidation reaction of BiOCl to achieve photochemical energy generation and storage. The revealed fundamental mechanism and proposed device design create new solutions to the renewable energy harvesting and storage field. This class of solar light direct-charging battery is an effective step to fulfill the need for green and sustainable energy developments and exhibits great promise for the commercial market.