Dustman is a free Firefox extension which automatically closes tabs which haven't been used in the last 20 minutes.
Sounds risky? Don't worry, Dustman is smarter than you might think.
The extension won't close tabs if you have less than 5 open, for instance, and it won't close anything you haven't viewed yet.
If you still lose something important, clicking the Dustman icon displays a panel with up to the last 100 closed tabs-- just click whatever you need to restore it.
All these figures and settings may be tweaked, enabled or disabled in Dustman's Options dialog.
If it still causes issues in some situations, that doesn't have to be a problem, as you can temporarily disable the extension in a couple of clicks.
A simple but effective way to free up valuable tab space.