Utilizing population-based survey data in epidemiological research with a spatial perspective can integrate valuable context into the dynamics of HIV prevalence in West Africa. However, the situation in the Mano River Union (MRU) countries is largely unknown. This research aims to perform an ecological study to determine the HIV prevalence patterns in MRU. We analyzed Demographic and Health Survey (DHS) and AIDS Indicator Survey (AIS) data on HIV prevalence in MRU from 2005 to 2020. We examined the country-specific, regional-specific and sex-specific ratios of respondents to profile the spatial–temporal heterogeneity of HIV prevalence and determine HIV hot spots. We employed Geodetector to measure the spatial stratified heterogeneity (SSH) of HIV prevalence for adult women and men. We assessed the comprehensive correct knowledge (CCK) about HIV/AIDS and HIV testing uptake by employing the Least Absolute Shrinkage and Selection Operator (LASSO) regression to predict which combinat