In SIR models, homogeneous or with a network structure, infection rates are assumed to be exogenous. However, individuals adjust their behavior. Using daily data for 89 cities worldwide, we document that mobility falls in response to fear, as approximated by Google search terms. Combining these data with experimentally validated measures of social preferences at the regional level, we find that stringency measures matter less if individuals are more patient and altruistic preference traits, and exhibit less negative reciprocity community traits. We modify the homogeneous SIR and the SIR-network model to include agents' optimizing decisions on social interactions. Susceptible individuals internalize infection risk based on their patience, infected ones do so based on their altruism, and reciprocity matters for internalizing risk in SIR networks. A planner further restricts interactions due to a static and a dynamic inefficiency in the homogeneous SIR model, and due to an additional reciprocity inefficiency in the SIR-network model. We show that partial or targeted lockdown policies are efficient only when it is possible to identify infected individuals.