it might just be out of warranty, but my first port of call would be the apple store to see if they are willing to replace free of charge.
They were really helpful with my wife's 3gs. The mic had intermittent problems and they replaced the phone there and then, no quibbles. She did have the extended apple care warranty though