One of the things that a phone's camera needs to be able to do is to capture a sharp image, regardless of how close or far it is from the thing it's taking the picture of. There are a few ways to do this. You can either make a smaller opening for light to pass through in front of the camera, or you can change what is considered "sharp".
Because the iPhone's camera uses a 2 megapixel sensor, the image it captures only needs to be sharp enough to seem sharp for that size. So, for a 2 megapixel camera, it does pretty well at a wide range of distances and light conditions.
If they were to take a 5mp sensor and put it in the same camera, then two problems would arise. First, since the camera makes higher resolution images, differences in distance would be much more noticeable. The N95 gets around that by having an autofocusing lens, but as a result, it's nearly twice as thick as the iPhone 3G. The iPhone's camera doesn't have an autofocus (hence this crazy contraption.)
Also, in order to fit more of those sensors into the camera, they often shrink them down to a smaller size. As a result, each of those little sensors is getting a smaller amount of light. If you're familiar with photography, then you probably realize that less light that gets to the sensors, the more you risk having some sensors underdeveloped, especially in low light conditions like at night.