The ongoing COVID‐19 pandemic has been linked to increased levels of stress, depression, and anxiety in many people around the world. Therefore, identifying individuals at risk of psychosocial burden during this unprecedented crisis is essential for developing prevention measures and treatment options for mental health issues. To this aim, we investigated two risk groups: individuals at higher risk of exposure to the virus and individuals at higher risk of poor prognosis if they contract the virus. We conducted a survey (
N
= 4167) with a representative sample of the German population and assessed perceived risk of COVID‐19 exposure and poor prognosis if infected, COVID‐19‐related anxiety, problems with sleep and daytime functioning, as well as self‐reported knowledge about the disease. Results showed that perceived risk group membership was linked to increased problems with sleep and daytime functioning via elevated levels of COVID‐19‐related anxiety. This mediated effect was further moderated by self‐reported COVID‐19 knowledge, but only for individuals who rated themselves at higher risk of COVID‐19 exposure. Thus, knowledge buffered the negative effect of exposure risk on anxiety and ultimately on sleep in this risk group. Reaching individuals at increased risk of exposure with clear information about the disease, how to prevent infection, and treatment options could be an effective strategy to contain anxiety levels and promote good sleep, which is important for general well‐being.