The invention discloses a 5G base station microgrid optical storage system capacity optimization configuration method based on energy sharing, and belongs to the technical field of optical storage system capacity optimization. The 5G base station microgrid optical storage system capacity optimization configuration method comprises the steps of: 1, analyzing operation and power generation characteristics of a 5G base station microgrid, including a base station load space-time characteristic model, a base station micro-grid operation characteristic based on a dormancy mechanism, a photovoltaic power generation model and a base station backup battery energy storage model; 2, establishing a double-layer model of an outer-layer model and an inner-layer model in energy storage configuration based on energy sharing; and 3, solving the double-layer model established in the step 2. According to the 5G base station microgrid optical storage system capacity optimization configuration method, the utilization rate of the photovoltaic and 5G base station standby battery can be improved, the capability of the 5G base station participating in peak clipping and valley filling of the power grid is improved, meanwhile, the 5G electric power expense is reduced, the upgrading and reconstruction of the power grid are delayed, and mutual benefit and win-win between a 5G operator and the power grid are achieved.