Quite possibly the motor will be OK after replacement of one or both head gaskets. This can be done with the engine still in the car. The definitive tests for whether this is needed are a compression test (shows head gasket leaks) and a radiator leak-down test (shows water jacket coolant leaks).
If it turns out the job is required it is a good idea to have the timing belt and water pump replaced also, and the crankshaft nose and camshaft oil seals. The cylinder head faces and mating block faces must be carefully checked for flatness.
Although more expensive it is advisable to specify genuine Toyota seals and gaskets as the cheaper non-genuine ones do not last on this engine.
The V6 has several characteristic oil leaks which develop, and that may not be related to the head gasket problem. It will leak from
- rear bank cam cover gasket, onto the exhaust- distributor shaft o-ring seal- oil filter bracket o-ring seal (if present)
These can be replaced at the same time.
The alternative is to have a 2nd hand motor fitted, which is always an unknown, but if you can get a warranty that will be better.
Get several quotes for each alternative, and try to gauge the reputation of the mechanicshttp://www.cartalk.com/content/mechanics-files