Background Host preference is a critical determinant of human exposure to vector-borne infections and the impact of vector control interventions. Widespread use of long-lasting insecticide-treated nets (LLINs) and indoor residual spraying (IRS) across sub-Saharan Africa, which protect humans against mosquitoes, may select for altered host preference traits of malaria vectors over the long term. Here, the host preferences of Anopheles arabiensis and Anopheles gambiae sensu stricto (s.s.) were experimentally assessed in the field, using direct host-preference assays in two distinct ecological settings in Tanzania. Methods Eight Ifakara Tent Trap (ITT), four baited with humans and four with bovine calves, were simultaneously used to catch malaria vectors in open field sites in urban and rural Tanzania. The numbers of mosquitoes collected in human-baited traps versus calf-baited traps were used to estimate human feeding preference for each site's vector species. Results The estimated proportion [95% confidence interval (CI)] of mosquitoes attacking humans rather than cattle was 0.60 [0.40, 0.77] for An. arabiensis in the rural setting and 0.61 [0.32, 0.85] for An. gambiae s.s. in the urban setting, indicating no preference for either host in both cases (P = 0.32 and 0.46, respectively) and no difference in preference between the two (Odds Ratio (OR) [95%] = 0.95 [0.30, 3.01], P = 0.924). However, only a quarter of An. arabiensis in the urban setting attacked humans (0.25 [0.09, 0.53]), indicating a preference for cattle that approached significance (P = 0.08). Indeed, urban An. arabiensis were less likely to attack humans rather than cattle when compared to the same species in the rural setting (OR [95%] = 0.21 [0.05, 0.91], P = 0.037). Conclusion Urban An. arabiensis had a stronger preference for cattle than the rural population and urban An. gambiae s.s. showed no clear preference for either humans or cattle. In the urban setting, both species exhibited stronger tendencies to attack cattle than previous studies of the same species in rural contexts. Cattle keeping may, therefore, particularly limit the impact of human-targeted vector control interventions in Dar es Salaam and perhaps in other African towns and cities.