A very common problem in iOS 4.x with 3GS
OP, I'll go out on a very sturdy limb here and say you're running 4.X
The good news is that there are ways to fix this; the bad news is that Apple seem to be hell-bent on ignoring this problem, and have been for months.
Some people have fixed it by changing their battery, others by jailbreaking and replacing part of the OS with the 3.1 equivalent ("mobilewatchdog") - but mostly by swapping their phone until they get a 4.x compatible specimen.
Some people report that it doesn't happen (or at least not as often) if you don't hold the phone during the call - eg, BT headset.
The problem seems to originate in a fatal interaction between the battery sensors and the OS. Rather than risk a meltdown when it can't read the battery temperature, it reboots. If you look at the crash logs, you'll probably find the infamous "stale battery temp" in there somewhere close to the reboot.
Mon Nov 8 16:49:52 unknown configd24 <Error>: watchdog: did not receive thermal notification in time: 0x0000003b
Mon Nov 8 16:50:01 unknown CLTM24 <Error>: CLTM: stale battery temp: now = 1289234999, lastupdate = 1289234813
Mon Nov 8 16:50:21 unknown CLTM24 <Error>: CLTM: stale battery temp: now = 1289235019, lastupdate = 1289234813
(not verified, but here is where to start looking)
You have to sync your device, then the crash logs will be at:
Mac OS X : ~/Library/Logs/CrashReporter/MobileDevice/<DEVICE_NAME>
WinXP: C:\Documents and Settings\<USERNAME>\Application Data\Apple computer\Logs\CrashReporter/<DEVICE_NAME>
Win Vista: C:\Users\<USERNAME>\AppData\Roaming\Apple computer\Logs\CrashReporter/MobileDevice/<DEVICE_NAME>
The thread became so huge on Apple's own support forum that they recently closed it and opened another! This has been going on for months, with no resolution.
There are ways to revert the 3GS to OS 3.x, which you can find with a web search. It will probably fix it too, if you can't get a replacement. Many people, long out of warranty, have shamed Apple into replacing their phones which are no longer fit for purpose - that is, they can no longer make phone calls!
Original Thread:
http://discussions.apple.com/thread.jspa?threadID=2471090&start=2220&tstart=0
New Thread:
http://discussions.apple.com/thread.jspa?threadID=2782776
This Apple arrogance is one of the reasons why I'm now a happy Android user. If it weren't for 'due diligence' digging up supply issues, Antennagate, this, and a few other niggles with the iPhone 4, I would probably be bitching about Steve's Walled Garden here

I've never looked back. My phone only has one 'killer problem' and that's the same for all smartphones - the battery capacity is less than half what it needs. Unlike the iPhone though, I can swap mine out in 30 seconds without tools.

2-3 days at most, frugally used, is just not enough for a phone that is never connected to a PC - everything is OTA. I would much rather have a phone that lasts 7-10 days on a charge and was 5mm thicker - and I suspect most people would, too!