While beta-amyloid (Aβ), a classic hallmark of Alzheimer's disease (AD) and dementia, has long been known to be elevated in the human immunodeficiency virus type 1 (HIV-1)-infected brain, why and how Aβ is produced, along with its contribution to HIV-associated neurocognitive disorder (HAND) remains ill-defined. Here, we reveal that the membrane-associated amyloid precursor protein (APP) is highly expressed in macrophages and microglia, and acts as an innate restriction against HIV-1. APP binds the HIV-1 Gag polyprotein, retains it in lipid rafts and blocks HIV-1 virion production and spread. To escape this restriction, Gag promotes secretase-dependent cleavage of APP, resulting in the overproduction of toxic Aβ isoforms. This Gag-mediated Aβ production results in increased degeneration of primary cortical neurons, and can be prevented by γ-secretase inhibitor treatment. Interfering with HIV-1's evasion of APP-mediated restriction also suppresses HIV-1 spread, offering a potential strategy to both treat infection and prevent HAND.