have you tried doing a hard reset? my 3g was having the same problem after I upgraded to iOS4, reset didn't help..then I did a hard reset (press home and sleep/wake button at the same time until phone turns off and then on again) and that seemed to fix it