In my experience, on not just my own iPhone 4 but also on my girlfriend’s, WD-40 restores the responsiveness of the iPhone’s home button to basically like-new condition. I just sprayed a little bit of WD-40 directly on the button, then pressed the button rapidly a few dozen times, tested its responsiveness afterwards, then repeated the process two or three times until it began to improve. Then I used the phone for a day or two to see how well the button did in actual use; I found that after a few days the problem ebbed back slightly, at which point I applied more WD-40. After the second or third application, the responsiveness remained indefinitely.
Caveat lector: I make no guarantees, and have no idea if this does any long-term harm to the device. I’m nearly certain someone will insist that it does, so anyone reading this and thinking about using WD-40 themselves should assume that this is a potentially risky fix, and I can accept no responsibilities for any damage done to your device. But for my part, I’ve had no problems with it, and it’s been six months or so since I tried this.
(Update: A friend suggests that this will void your warranty. I have no further knowledge on that issue, so, again, use your own judgment.)
In fact, I’ve found WD-40 to be a reliable and enjoyably analog fix to digital hardware for years. I first discovered this many, many years ago, when I asked an electronics repair technician if it was worth trying to fix an unresponsive button on a portable stereo that I then owned. He said don’t bother; just try a bit of WD-40. Since then I’ve used it on buttons on all sorts of hardware, always with success. The best part, of course, is that a can of WD-40 costs about as much as a sandwich and has a thousand uses.