There are a few approaches that you can take.
It seems like the ultimate problem that I'd want to address the "work like madmen" part. You should be striving for a sustainable pace, that is a level of effort that you can sustain indefinitely. The idea that you need to "work like madmen", yet aren't able to produce a quality product seems to be an issue.
How do you create a sustainable pace?
From a process perspective, take a look at your team organization. It seems like quality assurance is happening at the end. Consider the idea of a cross-functional team that works together. Don't put quality at the end, but involve quality at every step of the way. You may want to leverage continuous integration to help achieve this - if you have dedicated testers, regularly (nightly?) put changes into their hands and get feedback. Use automated tests to make sure that what they have is close to being correct, at least based on the developers interpretations of the expected results. If they find issues, update your automated tests to help prevent them from recurring.
From a team perspective, take a look at your sprint length. The length is almost always presented as 1-4 weeks. 2 weeks is on the shorter end of the spectrum. Maybe you'll be better off with longer sprints - adding an extra week or two.
From an estimation perspective, consider your definition of done. When is a story done? When it's implemented and unit tested? When it's integrated? When it's been integrated and passed acceptance criteria? It sounds like you need a solid definition of done and estimate the story points against the complete effort. That complete effort should likely include refactoring, unit testing, integration testing, and the acceptance testing effort. Make the whole team part of the effort.