In addition to the heterojunction layer, the interfacial layers also determine the performance of organic solar cells (OSCs) owing to their great role in promoting the charge extraction. Herein, the study explores the use of rarely reported polyaniline (PANI)-derived polymers as self-assembled hole-transporting layer (HTL) in OSCs. It is observed that the tailoring of either spacer groups or polymerization sites can greatly affect the material aggregation and thus OSC performance. Specifically, the polymer with phenyl spacer (36-Ph-PANI) largely outperforms that with alkyl linkers, which is ascribed to the enhanced aspect ratio and dipole moment of the former molecule that contributes to the substrate coverage and hole extraction. Moreover, the linking of PANI with carbazole at 2,7-sites is much inferior than that at 3,6-positions, attributing to the higher hole mobility of the latter induced by the formation of radical cation. The combined merits of 36-Ph-PANI, including high transmittance, appropriate doping, and efficient charge extraction, enable a decent efficiency of 15.08% in OSCs. This work provides a subtle strategy for developing hole-transporting polymers that can self-assemble into monolayers, paving the way for more efficient and stable OSCs.