We study targeted lockdowns in a multi-group SIR model where infection, hospitalization and fatality rates vary between groups—in particular between the 'young', 'the middle-aged' and the 'old'. Our model enables a tractable quantitative analysis of optimal policy. For baseline parameter values for the COVID-19 pandemic applied to the US, we find that optimal policies differentially targeting risk/age groups significantly outperform optimal uniform policies and most of the gains can be realized by having stricter lockdown policies on the oldest group. Intuitively, a strict and long lockdown for the most vulnerable group both reduces infections and enables less strict lockdowns for the lower-risk groups. We also study the impacts of group distancing, testing and contract tracing, the matching technology and the expected arrival time of a vaccine on optimal policies. Overall, targeted policies that are combined with measures that reduce interactions between groups and increase testing and isolation of the infected can minimize both economic losses and deaths in our model.