This paper demonstrates the economic benefits of using of day-ahead optimization and real-time control to plan and implement charging/discharging schedules for a behind-the-meter system comprised of PV generation and electric storage in commercial buildings. With investment costs falling over the past decade, distributed PV has become an increasingly attractive option for commercial buildings seeking to reduce energy costs. However, because PV is inherently intermittent, it cannot actively manage time-of-use tariff demand charges or respond to real-time prices or demand response signals. Missing out on these economic benefits amounts to a significant loss in value for the PV system. By pairing PV with electric storage and optimized control, commercial customers can begin to capture these benefits, leveraging synergies by storing energy from periods of excess PV generation and discharging as needed in other periods. Optimal planning of charging behavior is essential to the controller and ensures that complex cost and performance trade-offs are all duly considered and storage schedules are cost-minimal. The presence of the controller also reduces customer impact on the wider electricity grid, by granting customers a level of control over power flow to and from the grid. The potential economic benefits of this system may help PV and storage overcome their largest barrier—investment cost—while reducing the impact of wide-spread PV adoption for utilities, by creating more flexible, better integrated customer loads and generation. This paper shows that optimized control for PV-storage systems increases the annual energy cost savings by as much as 25% with significant increases to net-present-value for a real California facility under a commercial time-of-use tariff.