We investigate the effects of solvents on the geometry, absorption spectrum, and first hyperpolarizability of six push-pull molecules, each containing a 4,5-dicyanoimidazole group as an electron acceptor and a N,N-dimethylamino group as an electron donor, with systematically extended π-conjugated systems. Geometry optimizations in dichloromethane, methanol, water, and formamide under normal thermodynamic conditions were performed using the average solvent electrostatic configuration-free energy gradient method, which employs a discrete solvent model. The conformational structure of molecules is moderately affected by the environment, with the π-conjugated system becoming more planar in protic solvents. Solvent effects on the first hyperpolarizability result in marked increases that are in line with the red shifts of the absorption spectrum. The hyperpolarizability of smaller molecules within the set may be significantly influenced by the effects of geometry relaxation in highly polar protic solvents. The results illustrate the role of hydrogen bonds in the structure and electronic properties of push-pull molecules in protic environments. For smaller molecules, hydrogen bonds significantly contribute to enhancing the hyperpolarizability, but the effect of these specific interactions becomes less significant with the length of the π-conjugated system.