Bilbo is hardy. That is why Gandalf chose him in the first place. Hobbits are extraordinarily light on their feet, which is why he was able to sneak up on the spiders without them cluing in on the fact that he was invisible and therefore he was able to attack them from behind. His love for the dwarves is also an underlying factor, which gives him the strength to go on. He knows that he can't leave them like that, so he sets them free.
Hope this helps! :)