Cabotegravir is an integrase strand transfer inhibitor (INSTI) for HIV treatment and prevention. Cabotegravir-based long-acting pre-exposure prophylaxis (PrEP) presents an emerging paradigm for infectious disease control. In this scheme, a combination of a high efficacy and low solubility of anti-infection drugs permits the establishment of a pharmaceutical firewall in HIV-vulnerable groups over a long period. Although the structure-activity-relationship (SAR) of cabotegravir as an INSTI is known, the structural determinants of its low solubility have not been identified. In this work, we have integrated multiple experimental and computational methods, namely X-ray diffraction, solid-state NMR (SSNMR) spectroscopy, solution NMR spectroscopy, automated fragmentation (AF)-QM/MM and density functional theory (DFT) calculations, to address this question. The molecular organization of cabotegravir in crystal lattice has been determined. The combination of very-fast magic-angle-sample-spinning (VF MAS) SSNMR and solution NMR, as supported by AF-QM/MM and DFT calculations, permits the identification of structural factors that contribute to the low aqueous solubility of cabotegravir. Our study reveals the multitasking nature of pharmacophores in cabotegravir, which controls the drug solubility and, meanwhile, the biological activity. By unraveling these function-defining molecular features, our work could inspire further development of long-acting HIV PrEP drugs.