Marcel Proust wrote at night, during periods of chronic sleeplessness. So did Emily Bronte and Walt Whitman. Vladimir Nabokov, who believed that insomnia was a positive influence on his work, once said: "Sleep is the most moronic fraternity in the world, with the heaviest dues and the crudest rituals."
An all-night session at the Serpentine Gallery in London this weekend, co-hosted with the V&A, will explore the relationship between sleeplessness and creativity. The best way to do that is probably is when you are very tired. Gallery-goers are to camp out for the night, during which they will listen to lectures and watch films and performance art.
The idea of spending the night in an art gallery is perhaps not that tempting, given that one could be doing something more debauched. But it seems today's art lovers cannot get enough lectures and talks, even if they go on all night.
No other art institution has yet let visitors sleep all night in its galleries. But there will be no messing around at the Serpentine; the Sleepover is not for louche artist types who want to drink, eye up the opposite sex and slope off into to the bushes. It is to be a serious and self-conscious evening, providing plenty of opportunities for intellectual navel gazing. The psychoanalyst Darian Leader will give a talk about sleep disorders, dreams and art. If he sends his audience towards the land of nod, they will have access to a special sleeping area in this summer's swanky red pavilion, which has been designed by the French architect Jean Nouvel.
There will also be a taste of schoolgirl mischief, with a midnight feast. Modern performance art seems to incorporate every banal activity – sleeping, walking, reading. At the Serpentine, there will be a performance by the jelly makers Bompas and Parr, who will serve trifle with a twist. The trifle will be spiked with a stimulant or a sedative. Those who get the stimulant may be lucky – they may need it. If not it will be bye-byes, for a drug-induced snooze which will be a treat in itself. One is not usually allowed to sleep the night in Hyde Park, after all.
For the hard core, a series of lectures will begin at 2am. There is an argument that when tired, the mind goes into an altered state of consciousness and opens up to new ideas. The Serpentine lectures, geared towards the insomniac, will look at the benefits of sleeplessness.
Night owls say that creativity flows in the small hours, when the pressure and demands of daytime have ceased and they can sink into their imaginary world. Exhaustion can twist the mind and bring a whole new meaning to life.
This may be true, but it could also be that creative types are simply more susceptible to sleep problems. The stereotypical sensitive and neurotic artist, after all, struggles to relax at any time, overwrought as he or she is by a troublesome mind.
Tiredness has inspired many artists. The French writer Colette once said: "Insomnia is almost an oasis in which those who have to think or suffer darkly take refuge." Rudolf Nureyev used his extra hours of consciousness to pursue his greatest passions – dance and sex. The artist Louise Bourgeois suffered terribly from insomnia and made a series of drawings on the subject, including sketches of a ticking clock and an interpretation of the wild sleepless eye of an insomniac that will haunt any fellow sufferer. Another artist, Tomoko Takahashi, works through the night to create her elaborate installations.
Andy Warhol, Bruce Nauman and Douglas Gordon have made films about sleep. Warhol's Sleep was a five-hour-and-20-minute study of a close friend, John Giorno, asleep. Warhol said he had made the film because: "I could never finally figure out if more things happened in the 60s because there was more awake time for them to happen in (since so many people were on amphetamine), or if people started taking amphetamine because there were so many things to do that they needed to have more awake time to do them in... Seeing everybody so up all the time made me think that sleep was becoming pretty obsolete, so I decided I'd better quickly do a movie of a person sleeping."
At the Serpentine, a series of Insomnia Labs will explore the rich terrain between creativity and sleeplessness. There will be a discussion between the artist Laure Prouvost and the writer Melissa Gronlund about the relationship between insomnia and art and the scientist Dr Angelica Ronald and artist Lewis Ronald will explore why we sleep and the concept of sleep debt. This is the cumulative effect of not getting enough sleep. Such an idea will be as familiar to a young mother as to a strung-out artist.
It may be that a lack of sleep brings a new dimension to creativity. Many psychological studies, however, argue that most human beings think, work and function better when they are well rested. It may be that rest is just more difficult for some than for others. The curator of Sleepover, Hans Ulrich Obrist, is famous for his hard-working and sleep-deprived routine. But sleep debt, or deprivation, can lead to fatigue and even breakdown – a problem as common among artists as it is among the rest of the humankind.
For those who do manage to nod off every night, all is not lost. The moment of inspiration could be at hand. There is an entire history of dreams and creativity. The artist Jasper Johns painted his first American flag after seeing it in a dream. Doctor Jekyll and Mr Hyde, Frankenstein and "Kubla Khan" came to their authors in dreams. The novelist Stephen King dreamed the plot to Misery. He was flying on Concorde when he fell asleep and dreamed about a woman who took a writer prisoner, killed him and fed him to her pig. Paul McCartney dreamed the tune to "Yesterday". And it is not only artists who are dreamers. The German physiologist Otto Loewi won the Nobel Prize for medicine after he dreamed about how to prove his theory regarding the chemical transmission of nerve impulses.
If you should choose to take a brief snooze at the Serpentine, you will be able to analyse your dreams with Charles Arsène-Henry, who will give a talk on the content of dreams. Perhaps you will dream about being in a strange red pavilion full of art obsessives in a meadow in central London.
The real treat could come at dawn, with sunrise over the park and river. And who knows who will follow the Serpentine's lead. We could see sleeping bags in the Tate and pyjama parties in the Royal Academy, Academicians from centuries ago glaring snootily from the walls.
Sleepover, Serpentine Gallery, London W2 (08444 771 000) Friday