Here is a look at some of the problems that are happening with the iPhone 4 proximity sensor and how you may want to remedy or test it.
The iPhone's proximity sensor has been one of the most heavily discussed problematic areas of the iPhone 4's design, but this is likely only because of the recent issues with the iPhone 4's antenna and contract problems. In reality the iPhone has had proximity sensor issues in almost all of its incarnations, from the first generation through the iPhone 3G and the iPhone 3Gs. With the iPhone 4 these issues became even more common, especially when combined with the other failures.
In the past there have been problems with iPhone cases interrupting the functions of the proximity sensor. This was first a concrete issue with the iPhone 3G where a number of cases would not allow the iPhone to feel the motion of movement away from the face that would allow the iPhone touch screen to become active again during or after phone calls. This is less of an issue with the iPhone 4 bumper case, but can still be seen and is completely relevant with third party case designers. If you are wondering how to test the proximity sensor on your iPhone then seeing the differences with or without the iPhone's case will be the easiest method.
Ironically, the bumper case was given out free by Apple to hopefully remedy some of the dropped call issues that people have been experiencing. If those symptoms are what you are associating with the iPhone 4's proximity sensor then that specifically may not be the problem and instead the use of the iPhone bumper case may be the remedy. Try using it both with and without and see if there is a general change in the behavior of the iPhone 4 proximity sensor.
The reality is that the iPhone 4 proximity sensor problems are not always going to be hardware related. There have often been interruptions with the functionality of the iPhone 4 proximity sensor simply because of a cluster of settings decisions, though there has not been a clearly established causality between a specific set of settings and the issues with the iPhone 4 proximity sensor. To troubleshoot this easily you can go into the iPhone's Settings and select General, which will be at the top of the third block of options right above Mail, Contacts, Calendars. Go to the very bottom of the options and simply hit Reset, which will take you to a few different settings areas that you can reset. Here you can start by choosing Reset Network Settings and if this does not help then you can choose Reset All Settings. This is another way to test your proximity sensor on your iPhone since you can see if it is actually a software malfunction. Some users have reported that the proximity sensor issue is fixed for them after a reset, others report no improvement.
The reality is that the glitch in the iPhone 4 proximity sensor is there to stay for quite a while. There were no patches in the iOS 4.1 update to assist in the iPhone 4 proximity sensor problem and there has not been anything listed for the upcoming iOS 4.2 update. Instead we will have to wait until Apple actually does something about this, but until then you can try and adjust your usage and see how placement affects your proximity sensor.