Solar energy, as an inexhaustible renewable energy, can be used to produce heat and electricity. It is of great importance to examine the strategy for investment on solar energy technology. In response to varying electricity price in the electricity market, the battery energy storage system (BESS) can be used to get price arbitrage. This paper proposes an optimal configuration model for a photovoltaic (PV) system, solar heating system, and BESS in order to obtain maximum profit for investors. The investment potential of these systems is compared and analyzed based on return on investment (ROI) index which is defined to evaluate economic profitability. A bi-level programming is adopted to optimize the operation strategy of batteries (inner layer), the size of PV system and solar heating system, and the size of batteries (outer layer) including their maximum discharge/charge power and capacity. Sequential quadratic programming (SQP) method and particle swarm optimization (PSO) are used as optimization methods. In the case study, five investment strategies are investigated in order to decide how to invest in PV modules, batteries, and solar thermal collectors. The results show that the BESS may be a preferable choice for the investors if the investment cost of BESS goes down a lot in the future. Investing in solar energy for both heat and power may be not reasonable because the ROI of this strategy is always higher than either investing in heat or in power. The optimal strategy may be changed with the fluctuation of heat and electricity prices.