Background: Dengue virus and Japanese encephalitis virus are two common flaviviruses that are spread widely by Aedes and Culex mosquitoes. Livestock keeping is vital for cities; however, it can pose the risk of increasing the mosquito population. Our study explored how livestock keeping in and around a large city is associated with the presence of mosquitoes and the risk of them spreading flaviviruses. Methods: An entomological study was conducted in 6 districts with 233 households with livestock, and 280 households without livestock, in Hanoi city. BG-Sentinel traps and CDC light traps were used to collect mosquitoes close to animal farms and human habitats. Adult mosquitoes were counted, identified to species level, and grouped into 385 pools, which were screened for flaviviruses using a pan-flavivirus qPCR protocol and sequencing. Results: A total of 12,861 adult mosquitoes were collected at the 513 households, with 5 different genera collected, of which the Culex genus was the most abundant. Our study found that there was a positive association between livestock keeping and the size of the mosquito population—most predominantly between pig rearing and Culex species (p Cx. tritaeniorhynchus, collected in a peri-urban district, was found to be positive for Japanese encephalitis virus. Conclusions: The risk of flavivirus transmission in urban areas of Hanoi city due to the spread of Culex and Aedes mosquitoes could be facilitated by livestock keeping.