Structural stability, electronic, optical, and photovoltaic properties of pure and doped InP were evaluated by using first principles calculations via the density functional theory (DFT). The exchange-correlation potential is treated with generalized gradient approximation (GGA-PBE). Additionally, the Tran Blaha modified Becke-Johnson exchange potential (TB-mBJ) is employed, because it gives very accurate results of the band gap in solids. Our results reveal that all compounds are energetically and mechanically stable. It is found that for Y concentrations less than 30%, the favored structure is a Zinc blende-like one, while for Y concentrations greater than 30%, the favored structure is a NaCl-like structure. The substitution of In by Y is found to be able to enlarge the direct bandgap of about 34% (from 1.43 eV to 2.17 eV) and confirms the semiconductor behavior for zinc blende stable structures. The absorption coefficient is reasonably exceeding 105