The outbreak of coronavirus disease 2019 (COVID-19) prompted people to face a distressing and unexpected situation. Uncertainty and social distancing changed people's behaviors, impacting on their feelings, daily habits, and social relationships, which are core elements in human well-being. In particular, restrictions due to the quarantine increased feelings of loneliness and anxiety. Within this context, the use of digital technologies has been recommended to relieve stress and anxiety and to decrease loneliness, even though the overall effects of social media consumption during pandemics still need to be carefully addressed. In this regard, social media use evidence risk and opportunities. In fact, according to a compensatory model of Internet-related activities, the online environment may be used to alleviate negative feelings caused by distressing life circumstances, despite potentially leading to negative outcomes. The present study examined whether individuals who were experiencing high levels of loneliness during the forced isolation for COVID-19 pandemic were more prone to feel anxious, and whether their sense of loneliness prompted excessive social media use. Moreover, the potentially mediating effect of excessive social media use in the relationship between perceived loneliness and anxiety was tested. A sample of 715 adults (71.5% women) aged between 18 and 72 years old took part in an online survey during the period of lockdown in Italy. The survey included self-report measures to assess perceived sense of loneliness, excessive use of social media, and anxiety. Participants reported that they spent more hours/day on social media during the pandemic than before the pandemic. We found evidence that perceived feelings of loneliness predicted both excessive social media use and anxiety, with excessive social media use also increasing anxiety levels. These findings suggest that isolation probably reinforced the individuals' sense of loneliness, strengthening the need to be part of virtual communities. However, the facilitated and prolonged access to social media during the COVID-19 pandemic risked to further increase anxiety, generating a vicious cycle that in some cases may require clinical attention.