This paper proposes an efficient approach based on Virus colony search (VCS) algorithm to optimize the sizing and placement of stand-alone hybrid power system including photovoltaic solar panels (PV) and battery bank in system which employ diesel generators (DGs) as pilot source of electrical energy formatting hybrid system. The optimization is carried out to incessantly satisfy the load demand. Two objectives have been defined: the reduction of the equalized cost system (economic objective) and equalized CO2 equivalent life cycle emissions (environmental objective). In the optimization problem, the dependability index of not supplied energy (NSE) is also considered to have a reliable system. The VCS algorithm is an effective and powerful approach that has fast convergence and high precision. This algorithm simulates diffusion and infection strategies for the host cells adopted by virus to survive and propagate in the cell environment. With the policies, the individual in the new algorithm explores and exploits the search space more professionally. This study is applied to Fort-Lotfi City: Tindouf (South of Algeria) that still needs access to National grid electricity due to economic and geography matters. The results prove the advantages of hybrid power systems in isolated locations ranging from being cost effective and reducing the accumulated emissions. The proposed algorithm is compared with PSO and MPSO algorithms which confirm its best performance and effectiveness.