In all the recent statistical analysis and commentary on the epidemic of loneliness, perhaps the most striking is that, more than any other age group, it’s middle-aged people who are now reporting feelings of isolation. According to the Office for National Statistics, loneliness afflicts around one in seven of those between 45 and 54.

Middle age is that phase of life in which our possibilities and freedoms seem to contract most dramatically, where our sense of who we are and will be is liable to feel most constrained by pressures from all sides. The disappointments and anxieties of unfulfilling work, unhappy family life, and our own or others’ poor health are intensified by the conviction that there is no escape: this is simply the hand fate has dealt us. It’s not hard to imagine what a lonely feeling that can be.

A refrain I hear regularly in my consulting room is the anxiety of the unreturned text or email, or the ignored update

While there is nothing new about this state of midlife resignation, it takes on a new force in our age of global, networked consumer capitalism. Our lives are ever more psychologically and economically precarious; the families, homes, jobs and pensions that we look to as guarantees of a secure future are instead sources of deep uncertainty. At worst, it can feel as though we’re caught between a regrettable past and a hopeless future.

These conditions of precariousness are bound to aggravate our vulnerability to the judgment of others and ourselves. The middle-aged person is liable to look in the mirror and see someone who could have done better, who has failed to fulfil their hopes and ideals.

And what hope of change at this point? Whatever the disappointments of work or family, the prospect of giving up either may seem a lot worse. You can change your body or clothes or car or musical taste, but out of the corner of your eye you’ll perceive the wry mockery of younger people – perhaps of your own teenage children. And worse, something in you feels like joining in.

Social media may seem like the ideal remedy. If everyday reality has come to feel cumbersome and grey, the online world gives you the chance to remake the self, project the person you’d like to be. Facebook and Twitter cultivate an atmosphere of perpetual mutual affirmation and warmth, providing a rolling assurance of your value and lovability. But no sooner is loneliness banished than it returns. This idealised version of yourself is, after all only a defensive carapace, so that the gap between your happily sociable online and lonely offline lives becomes a kind of reproach. Moreover, it doesn’t take long for subtle provocations and direct attacks to crack the veneer of online friendliness and entrench the very feelings of isolation you were trying to escape. Affirmation and rejection turn out to be two sides of the same coin.

Of course, social media don’t, in and of themselves, cause loneliness. But they are a luminous expression of a culture that encourages us to relate to each other in ways that undermine the very security we’re reaching for.

A refrain I hear regularly in my psychoanalytic consulting room is the anxiety of the unreturned text or email, or the ignored status update. The anxiety brings out a crucial difference between real and virtual contact. An ordinary encounter makes space for quiet proximity, the ineffable pleasure of simply being with someone. Online communication tends to preclude this kind of intimacy. Where the silence of the person next to me can allay my feelings of loneliness, the silence of the virtual interlocutor breeds suspicion and paranoia: what have I done? Why don’t they like me any more? Did they ever like me?

One way of understanding psychoanalysis is as a form of contact that isn’t premised on approval. A patient said to me last week: “You seem to be the only person I can speak to these days without worrying too much about what you’re thinking.” In middle age, as I’m told so often from the couch, our responsibilities are apt to distance us from our closest friends, just at the point we may most feel the need of their friendly ears.

What Freud called psychoanalytic neutrality isn’t surgical coldness but a kind of benign receptivity, a willingness to make yourself available to whatever someone wants to tell you. For the psychoanalyst DW Winnicott, this way of being with someone cultivates a “capacity to be alone” that is very different from loneliness – closer to what the romantic poets called solitude. It is rooted in the infant’s early intuition of the continuing existence of her mother, enabling her to feel the presence of someone even when alone. This intuited presence provides an emotional lining that helps us feel less helplessly dependent on others.

In middle age, this sense of internal assurance is worn away by doubts and insecurities. Our culture of consumerism and competition undermines it further. As long as we build relationships on the shaky foundations of an infantilising wish for the regard of others – on the quantity of “likes” rather than the quality of intimacy – the spread of middle-aged loneliness is unlikely to abate.