Into bed and lie down. Head goes on pillow. Out of bed; superstitiously plucking the strewn clothes from the floor to fold them into rough bundles and put them away – one of countless little routines undertaken to forfend a sleepless night. One of countless little routines forcibly dismissed as superstition, in the superstition that superstitious acts will only shorten the odds of sleep – but unignorable in the end. Needs must. The attaining of sleep long ago left the realm of natural act and entered that of black magic. Back into bed and read, a collection of William Trevor short stories. There’s sleepiness soon, like something calling from around the corner. There’s a sharp, stinging pain at the crown of my head; the scalp is being stitched with embroidery needles. The lamp is shut off and the room is more or less dark. An odd creak issues from who knows where.

The heart starts up its thrup-thrup-thrup, a tripping percussion in a chest that now fills with breath. Breathe, breathe. I close my eyes and try to keep hold of that sleepiness, whose call is still there behind the heart’s syncopation. The heart a tough lump of meat, flooded with fear. Fifty minutes pass; it’s almost one. Usually if sleep is going to come it would have come by now; and if it hasn’t come by now, the probability is no sleep at all.

Lying on one side, cradling my head. Sleepiness vanishes, like the picture when you turned off an old TV screen; it recedes to a dot. Then there’s blankness and blackness; the yawning expanse of a night awake.

Case study of possible chronic Post Brexit Insomnia (PBI)

Patient, female, 43, has always slept well. She reports both ease of going to sleep and of staying asleep, usually for around eight hours a night. This pattern has tended to hold even in times of stress and difficulty.

The patient reports that her problems with sleep began a few months after she moved house to live on a main road, when she was often woken early by traffic. Over a period of months, her sleep disturbances fluctuated. In June 2016 they began to be accompanied by anger at the result of the European referendum, resulting in periods of restless wakefulness. By the autumn of this year she was not only waking up early with the traffic, but finding it difficult to go to sleep at bedtime.

During this period she battled with anger and frustration at both the traffic and the unfolding senselessness of politics. She tried various strategies for endurance (earplugs, white-noise generation, alcohol), as well as for acceptance (mindfulness meditation, Buddhist mantras, affirmations of loving kindness), but found them of limited use.

By October of the year in question, her sleep problems had become what she would now call insomnia – difficulty going to sleep and staying asleep. She went on a silent Buddhist retreat but did not find any improvement in her sleep. Indeed, it was here that she first detected the existence of persistent panic.

On arriving home, she recalls meeting her next-door neighbour at the bus stop, who told her of the death of their lodger. Later that day she was informed of the separation of her sister and partner. Some days after this, she learned of the death of her cousin, who was found in his flat two days after he passed away. Some days later she was informed that her father’s partner had been diagnosed with dementia. A week or two after her cousin’s funeral, she learned that her father had fallen from a ladder, had badly broken his leg and would be unable to walk for a year.

Some nights she would lie in darkness for seven hours, counting backwards from one hundred in French or German

Her sleep problems worsened. Sleeping aids – over-the-counter (Nytol, Sominex, Dormeasan drops, CBD oil, magnesium powders, passion flower, hop strobiles, melatonin, 5HTP) and prescription (Zopiclone, Diazepam, Mirtazapine) – were of little use.

The patient tried many remedial approaches, including visits to a CBT sleep clinic, acupuncture, a stress-reduction mindfulness course, sleep restriction techniques, gratitude diaries, dietary supplements, abstention from caffeine and sugar, and a sleep device that emits alpha, beta and theta waves to mimic the stages of sleep. Her approaches also included experimenting with bedtimes and finding ways to occupy and calm herself during her hours of wakefulness. She reports learning French, making mosaics, playing solitaire, doing jigsaws, counting her breaths.

She reports that her aim shifted from trying to sleep to trying not to panic, and that some nights she would lie in darkness for seven hours, counting backwards from one thousand in threes, or counting backwards from one hundred in French or German.

Her abiding feelings over these weeks and months were of anger, loneliness, despair and fear. She suffered recurring images of her cousin in his coffin underground. She also reports suspicions of having fatal familial insomnia, an extremely rare hereditary disease resulting in premature death.

There were fierce panic attacks at night, during which she would hyperventilate, convulse and hit her head, either with her own fists or against a wall.

The patient’s work and social life became unviable. By now she was experiencing around three or four nights a week of no sleep, and intermittent sleep the remaining nights. She would regularly stay awake for 40 or 50 hours. Physical symptoms of sleeplessness included confusion, memory loss, palpitations, severe headaches, hair loss, eye infections and numbness in her hands.

•••

Dust and ashes though I am, I sleep the sleep of angels.

This is the first line of my most recently published novel. I don’t know the person who wrote that line. The person who wrote it didn’t know anything. She didn’t know the first thing about anything.

Dust and ashes though I am are not even her words; they are from St Augustine’s Confessions. I sleep the sleep of angels are her words, but she knows nothing of angels and knew nothing then about sleep (in the way fish know nothing about water), she was just hazarding guesses, she was as green as a shoot.

But my sleep was ragged that night, she wrote. But she didn’t know anything about ragged sleep when she wrote that. She knew the word ragged and she knew it was an adjective that could describe many things, including sleep, but she knew nothing about ragged sleep. Nowadays she is shocked by the fraudulence of words. Every word claims an authority and every word craves to be believed, and we read others’ words and we find something to relate to, solace in a shared experience. Yet there doesn’t have to be any experience behind a word. A word can be a shadow not cast by any object.

Much is said to disparage authors who write outside of their expertise, and worse still, who appropriate the experience of others but nobody took the pen from my hand when I, well slept, found a notion in my brain of sleeplessness.

Take the plunge … swimming offers a cure for insomnia. Photograph: Carl Smith/Getty Images/fStop

1am

Lie here then. Just lie here. What of it? It’s just lying here. Think of good things.

The sky in France – so vast, so black, so star-spangled that when we got out of the car our gazes were pulled up to it, both of us at once, and we stood silently gaping. The Milky Way was a wide, distinct bow exed above us and the stars – staggering in their numbers – did in fact twinkle.

The sunsets in France, a roaring red horizon and the hazy moon above, like a moth smoked out of a fire; Venus, Mars, Jupiter and Saturn all visible at once. Bats pouring out of the ruined tower of the medieval chateau, swooping above our heads and pouring in again. The fading call of crickets. My swimming costume hanging on the balcony railings going loose with chlorine and overuse, loose with two months of swimming.

I think about the swimming, going up and down the pool. My underwater slipstream, my hands ageless and bright. Count your blessings.

There’s something called “nocturnal forgiveness”, which is the act of letting go of all wrongs and all guilt or blame, just for the duration of the night. You leave them outside the room. I forgive everything I can think of one by one – the cars driving past too fast, the jackdaws for ransacking the bird feeder, the universe for torturing me, myself for torturing me. What I suddenly think of is my dad plaiting my hair when I was nine years old, in the first few weeks after my mum left. Plaiting my hair with his huge, scarred, leathery builder’s hands.

•••

It’s half past one, quarter to two. I’m trying to collect plums that have fallen from a tree on to the floor of a restaurant, burgundy plums, very ripe, some trodden in. Simultaneous to this comes the knowledge that I must be dreaming and therefore partly asleep, and with the realisation of this I have the swiftest moment of triumph – I’m asleep! – before waking up.

Maybe it’s the menopause, my friend says. Could it be, already? I always feel like a child the instant I sit before a doctor, and in this case my sense of being one makes it all the more incongruous when I ask about the menopause.

She says I don’t sleep because I’m anxious. Have you thought about counselling? the doctor asks. I tell her I’ve been seeing a counsellor. And do you think that’s a good thing to do? Good in what way, I want to ask. Good as in wholesome, or as in useful, or as in morally right, the only morally right thing a person can do when they’re meanwhile burdening the NHS with their ailments, ailments which originate in the mind?

Yes, I say. Good. So you’ll carry on with it? Why is it – she’s thinking – that she has to sit there day after day listening to patients who refuse to take responsibility for their own wellbeing? People in Syria can sleep with bombs falling, why can’t you sleep on your king-size mattress with your winter-togged duvet and your kelp-scented hair on a fake-down pillow under a bomb-free sky? What pea disrupts your sleep, princess? A passing Audi? What paucity and fragility of spirit has left you relying on drugs to do that which is the natural inheritance of all animals everywhere and for ever?

3 am

I get up. Current wisdom is conflicted on this. Some sleep regimes say you should get up if you’re still awake after 20 minutes, so that you don’t associate bed with sleeplessness. Others say you should stay in bed regardless, so that you don’t signal to the body that it’s normal to be up in the night; instead you stay in bed and accept what comes.

Inherently inert at night, and clinging on to some idea of myself as a good sleeper, I’m much more predisposed to the latter. Tonight, though, I get up. I’m restless. I make a cup of tea. Absolutely no sleep regimes advocate having a caffeinated drink at 3am but I did it once and went straight to sleep afterwards, so occasionally I try it just in case it works again, which it never has.

There’s a line from a Philip Larkin poem that comes to me. Sitting on the sofa in my underwear, drinking tea, I do the other thing no sleep regime advocates – I go online. There is the poem in which Larkin remarks on the oblivion of death. It is “only oblivion”, he says: “We had it before, but then it was going to end, / And was all the time merging with a unique endeavour / To bring to bloom the million-petalled flower / Of being here.”

It feels like a bell ringing distantly, like the heralding of company in what you thought was a desert or an abyss. Suddenly I don’t feel lonely, I feel elated, and everything is soft and full of echoes and resonance. At around half past three I go back to bed. To have come this far through the night and feel in some way peaceful is surely an augur for sleep. Also, I’m cold. Getting into bed, nestling down, there are a few minutes of contentment that remind me of how it always used to be. I used to love going to bed. Remember that now. My life, so convoluted and iterative and searching, is nothing more complex or more simple than the million-petalled flower of being here. I am alive, I think, as if I’ve just discovered an extraordinary fact.

4am

The flight from Bristol airport passes over in a distant smear of sound. I switch on the light, get my laptop and Google I AM AWAKE. An article explains how fear and anxiety, often conflated, belong to different parts of the amygdala – fear arises in its central nucleus, which is responsible for sending messages to the body to prepare a short-term response – run, freeze, fight – whereas anxiety arises in the area responsible for emotions, a part which affects longer-term behavioural change. Fear is a response to a threat, anxiety a response to a perceived threat – the difference between preparing to escape a saber-toothed tiger that is here and now in front of you (because it’s always saber-toothed tigers in the examples) and preparing to escape the idea of a saber-toothed tiger in case one appears around the next bend. While fear will quickly resolve – you will run away, fight it or be eaten – anxiety has no such resolution. You will need to stand guard in case. Standing guard will make the perceived threat seem more real, which necessitates a more vigilant standing guard. Fear ends when the threat is gone, while anxiety, operating in a hall of mirrors, self-perpetuates.

Sleep deprivation isn’t a perceived threat but a real one, like thirst or starvation

For me, now, a puzzle emerges. What, then, fuels insomnia – fear or anxiety? Anxiety, everyone says. Anxiety, my hypnotherapist says; you are safe in your bed yet your heart is racing as if a tiger is present. You must learn to see that there is no tiger.

But there is a tiger: sleep deprivation. Sleep deprivation isn’t a perceived threat but a real one, like thirst or starvation. It is no use to say “don’t be afraid”. There is a tiger in your bedroom, you ought to be afraid.

The urge to take a sleeping pill suddenly overwhelms me; to be free of thought, of amygdalas and tigers. Well gone four, too late to take a pill – they don’t work when it’s this late, when I’m adrenalised with fear. Besides, I take too many; they give you cancer, dementia, so they say. I am exhausted to my marrow and down to the tip of each nerve ending.

It will be getting on for 5am by now; I do a quick summary of which of the coming day’s plans I can get away with cancelling. Panic wells.

•••

How can I describe this feeling I have when I lie down to sleep and it’s as if I’m falling from a 50-storey building, and there’s nobody, nothing, to catch me? See, that isn’t describing it. That’s describing something else. What use is there in coming up with a metaphor of something I’ve never experienced to describe something I often experience?

You see, already the building metaphor doesn’t even work as a metaphor. With the fifty-storey building the fear, presumably, is in hitting the ground, when really my fear is that there is no ground. I heard somebody describe his abiding anxiety as that moment when you tip back in a chair and think you’re going to fall. That moment, but all the time. It’s not even about what’s going to happen next, it’s just the vertigo of the moment, when all sturdiness falls away.

Photograph: Dan Burn-Forti/Getty Images

I haven’t slept since Sunday night, I say. I have never cried in front of a doctor before, but there she was, straight backed, prim and discouraging. And I, unslept since Sunday night. Today is Friday. I can think of nothing but sleep. I would kill somebody if it meant I could have theirs.

This is a surprise, she said, and I sat and cried. Is it a surprise? I wanted to ask. She meant: you were only here on Monday. With her blessing, I’ve taken myself off the sedating antidepressants given that I’m not depressed (sleep-deprived, desperate, mad, but not depressed) and they’re not sedating me any more. Since then, Monday, I haven’t slept. Four nights in a row without sleep. Thus, here I am a child in tears.

I need some sleeping pills, I say. She stares at me as if my tears have appalled her, or somehow confused her. Please, I say. Instantly I regret this because now the power is with her; now my night’s sleep is a favour she can grant. And yet it is. And if it would help to fall at her feet and supplicate myself, I would.

She hands me a prescription of 14 pills; she offers no advice, no support. I take the prescription from her and leave without a word. In the eyes of the doctor, I am just neurotic and self-obsessed.

5am

The collecting tide of the night gathers itself up into a wave. Can’t do it, can’t do it, can’t cope, can’t go on. Too many nights awake, too much darkness and loneliness, can’t do it. Am downstairs without knowing it, pacing, lunatic, shaking, tugging at hair, wheeling about in search of true north. My true north appears in the living room, shocked and sleepy, takes my wrists in his hands, Sshh, it’s all right, it’s OK, everything is OK, it’s all right. Wishing to scream, finding myself screaming. “No” the only word the brain seems to remember, no to everything, no.

•••

Writing is dreaming. I only discovered that a couple of years ago. It is lucid dreaming – the work of the subconscious that has a toe in the conscious, just enough to harness the dream’s waywardness.

My mind is a cacophony. It thinks useful thoughts, and for every useful thought it thinks another four hundred useless, repetitive ones, and of those useless, repetitive ones a significant number are toxic. Shoulds and shoudn’ts. Eviscerations of self. Eviscerations of others. Terrors. Regrets. Reprimands. Old arguments. The mind is a tyrant; telling you what you ought and ought not to have done, which is never what you did or didn’t do.

None of this matters when I write. Writing has saved my life. In the last year, writing has been the next best thing to sleep. I am sane when I write, my nerves settle. I become happy. Nothing else matters when I write, even if what I write turns out to be bad. I proceed from some open and elusive subconscious formlessness roughly called “me”, definable only by being nothing and nowhere, just the silence in which shapes move. Then words. Words harnessing things. There is the comfort of organisation, of shepherding chaos, not trying to abolish it but shepherding it towards borders, taking away the problem of infinity and entropy. Proffering the illusion of completeness. And somehow, I start to see myself out there in the words I’ve made, out in their many worlds, scattered and free.

•••

The blood was coming from my head, yet I was alive. At night, 15 years on, I force myself to remember this

Fifteen years ago, a homeless man in Australia took against me one night when I was walking home on my own, and he pummelled my head with an unidentifiable object while I, hands on head, scrambled into a small clearing under some bushes. When he had finished pummelling my head he disappeared, and I ran out of the bushes towards a taxi rank, which was the only source of help in a deserted little town.

Waiting for an ambulance, on a bench with my head in my hands, my hands filled with bright blood and blood soaked the lap of my jeans and dripped on to my shoes in a way I couldn’t comprehend, because it was coming from my head and was the sort of quantity of blood that suggests death, yet I was alive.

At night, 15 years on, I force myself to remember this. The supposition is that remembering something objectively bad and frightening might take my mind from the abstractions of anxiety, might alert my skittering heart to the good fortune of being safely in bed. Feeling for the long scars at the crown of my head might prompt me into self-care and away from the impulse to hit my head against a wall. And maybe if I replay that memory I might find it, the thing, the source of malfunction that 15 years later surfaces as sleeplessness. Maybe a fear of the dark, a residual feeling of threat, an anticipation of attack that keeps me on my guard?

•••

“Why don’t you spray some lavender on your pillow?”

“Because I’m beyond lavender.”

“It can’t hurt to try.”

“It can’t hurt to rub myself down with dry beech leaves in the moonlight, but will it help, is the question.”

“This is all about staying positive.”

“Is it?”

“No spirals of negative thought. It might sound like an old wives’ tale, but a hot milky drink at bedtime does help. Nice comforting things, little acts of kindness towards yourself.”

“Does jumping out of a top-floor window count as a little act of kindness towards myself ?”

“Are these sessions helping, would you say?”

‘Writing has saved my life’ … Samantha Harvey. Photograph: Roberto Ricciuti/Getty Images

7.30am

Here is the pile of yesterday’s clothes on the floor. I get into them in the precise reverse order I vacated them the night before: bra, top, jeans, jumper. Always, something unbearable about this process – the process of getting dressed in the morning after a night of no sleep, getting into the very clothes you took off the night before when you embarked on the ritual of bedtime as if such things as sleep applied to you any more. The pile of clothes is an open rebuke. I want to say they mock a lost innocence even though I know this makes no sense, but more and more I make this unconscious association between innocence and sleep.

I suppose it isn’t a new association; it’s one I made myself when I wrote that opening line in my novel: I sleep the sleep of angels. It’s one we make from childhood – the sleeping infant, untroubled by conscience or the weight of the world, or in the fairytales that have people slumbering for a hundred years; it’s there in Shakespeare when he writes, in Romeo and Juliet, “where care lodges, sleep will never lie”, and in that line in Macbeth: “innocent sleep, sleep that knits up the ravell’d sleave of care”. “Balm of hurt minds,” he calls it. “Chief nourisher in life’s feast.” And there it is in death, the ultimate surrender and eternal rest, the dreamless sleep, the reconciliation, the forgiving annihilation, the letting go no matter what. No matter what your life was, there comes this final benediction.

Sleep. Sleep. Like money, you only think about it when you have too little. Then you think about it all the time, and the less you have the more you think about it. It becomes the prism through which you see the world and nothing can exist except in relation to it.

In yesterday’s clothes, I go outside. This morning is grey but not dull. January light is unlike December’s, already it has the beginnings of that clarity and expanse that culminates in spring. The snowdrops are little acts of resistance.

Cure for insomnia

Take a river, lake, ocean or other body of open water; a swimming pool will do if cold enough and outside. Fresh air is key; cold is key. Get in. Jumping or diving is best but any approach suffices if the end result is in and so long as head is submerged soon and completely.

Swim against, against, against. Swim into the waves or current. Thus allowing the body of water to assert itself over your own body and to overwhelm the thinking mind.

Swim with, with, with. Swim as the waves or currents go. Thus allowing the body of water to assert itself as an upward and outward force, for it is the downward and inward nature of the thinking mind that brings on the sadness and madness. If a thought should emerge that is overly small or turning inward, head under, drown it.

In the lake feel the earthy softness of the water, and in the pool feel the bleached crispness, and in the lake see underwater how your hands emerge as ghost hands in the mill of the stroke, only to evaporate when the stroke recedes, while in the pool your hands are shocks of electric white which trail with the diamonds of sunlit bubbles. To the thinking mind, which sinks its anchor in the past and present where no anchor will fix, tell this: no things are fixed. Even your hands from day to day are not the same hands.

This is the cure for insomnia: no things are fixed. Everything passes, this too. One day, when you’re done with it, it will lose its footing and fall away, and you’ll drop each night into sleep without knowing how you once found it impossible.

• The Shapeless Unease: A Year of Not Sleeping is published on 9 January by Jonathan Cape.