In my experience, most developers are over-optimistic and tend to under-estimate.
However it’s not uncommon for some teams to estimate on the cautious side. If you find yourself in this situation and finishing the Sprint (or time-box) early, include a couple of nice-to-have “stretch tasks” (or features/stories) in future Sprints.
It’s important to specifically identify them as stretch tasks, i.e. “could haves” in MoSCoW terms (Must-have, Should-have, Could-have, Won’t-have). Make sure no-one is ever beaten up if no stretch tasks are ever achieved in the Sprint. By contrast, do make sure you celebrate as a team if you reach any stretch tasks – even if it’s just a lot of back-slapping and self-congratulation!
And don’t forget to apply the same rules to the stretch tasks as everything else; they must be 100% complete (i.e. shippable) to count.
See also: 10 Key Principles of Agile Development