Elves sleep, not just in The Hobbit, but also in LoTR and in The Silmarillion, but it seems they can go without much longer than, for example, dwarves. When Aragorn, Legolas and Gimli were pursuing the orcs to rescue the kidnapped Merry and Pippin, Gimli had to explain to Legolas why they have to rest:
And yet even I, Dwarf of many journeys, and not the least hardy of my folk, cannot run all the way to Isengard without any pause,’ said Gimli. ‘My heart burns me too, and I would have started sooner; but now I must rest a little to run the better. And if we rest, then the blind night is the time to do so.’
‘I said that it was a hard choice,’ said Aragorn. ‘How shall we end this debate?’
‘You are our guide,’ said Gimli, ‘and you are skilled in the chase. You shall choose.’
‘My heart bids me go on,’ said Legolas. ‘But we must hold together. I will follow your counsel.’~LoTR, The Two Towers
When Aragorn later wakes up Legolas is awake, standing there and complaining how much time they'd lost.
As the chase continues, the others are exhausted, but Legolas is fresh as ever:
For many hours they had marched without rest. They were going slowly now, and Gimli’s back was bent. Stone-hard are the Dwarves in labour or journey, but this endless chase began to tell on him, as all hope failed in his heart. Aragorn walked behind him, grim and silent, stooping now and again to scan some print or mark upon the ground. Only Legolas still stepped as lightly as ever, his feet hardly seeming to press the grass, leaving no footprints as he passed; but in the waybread of the Elves he found all the sustenance that he needed, and he could sleep, if sleep it could be called by Men, resting his mind in the strange paths of Elvish dreams, even as he walked open-eyed in the light of this world.
It seems elves can enter some kind of meditative state and 'rest their minds' while being physically active, that is, they can rest without lying down and sleeping.
And the night before they'd met the riders of Rohan:
The night grew ever colder. Aragorn and Gimli slept fitfully, and whenever they awoke they saw Legolas standing beside them, or walking to and fro, singing softly to himself in his own tongue, and as he sang the white stars opened in the hard black vault above. So the night passed.
So it seems that elves can stay awake for an extended period of time with a bit of meditation without consequences. The question is, how long can they do it without a 'proper' sleep? Can they do it indefinitely? Do they need sleep at all?