Poly(3-hexylthiophene-2,5-diyl) with the acronym P3HT and its derivatives are p-type conjugated semiconductor polymers that have been proved to be good organic semiconductors. They have several applications in many areas, such as photovoltaic systems, organic light-emitting diodes, and so on. The instability of organic molecules under ambient conditions is one factor deterring the commercialization of such organic semiconductor devices. Here we present a theoretical study using density functional theory (DFT) approach with Gaussian 09 and GaussView 5.0, to investigate the effects of halogens (Bromine, Chlorine, Fluorine and Iodine) on the electronic and nonlinear optical properties of poly(3-hexylthiophene-2,5-diyl) (P3HT). This is to enable us to address the issue of instability in the molecule. The bond lengths and bond angles of the mono-halogenated molecules were found to be less than that of the isolated Poly(3-hexylthiophene-2,5-diyl). Iodine doped P3HT was found to be the most stable amongst the studied molecule for having the least bond angles and bond lengths. The calculated band gap for iodine doped P3HT and fluorine doped P3HT were observed to have the lowest energy gap of 3.519 eV and 3.545 eV respectively thus proving that iodine doped P3H is the most stable and this makes it more suitable for photovoltaic applications. The molecule with the highest value of chemical hardness was obtained to be the isolated P3HT with a chemical hardness of 1.937eV. This is followed by bromine doped P3HT, chlorine doped P3HT, fluorine doped P3HT and iodine doped P3HT with values as 1.925 eV, 1.813 eV, 1.773 eV, and 1.7595 eV respectively. All the substituted molecules results were found to be more reactive than their isolated form for having lower values of chemical hardness. The results for the nonlinear optical (NLO) properties show that the first-order hyper-polarizability of chlorine doped P3HT and iodine doped P3HT as and respectively were found to be about eight times more than that of the urea value (0.3728 x10-30 esu), which is commonly used for the comparison of NLO properties with other materials. This makes them very good NLO materials. The open circuit voltage was also calculated. The highest values of the calculated open circuit voltage were found to be (PCBM C60) in chloroP3HT and 1.3134 eV (PCBM C60) in flouroP3HT. The results of the IR frequency show that the doped molecules are more stable than the isolated molecule. Zero-point vibrational energy (ZPVE), total entropy (S) and molar heat capacity (Cv) were also calculated and presented. We also observe that the entropy and heat capacity of the doped materials are higher than those of the original molecule, which confirms that the charge dynamics of the doped molecules are higher than those of the original molecule at the same temperature. This result further demonstrates that these doped materials have a high chemical reactivity and a high thermal resistivity, hence their application in the fields of organic electronics. By and large the overall results confirm that there is a good electron transfer within the doped molecules which makes them have potential applications in photovoltaic devices.