Cliffnotes: I'd go with junkyard motor.
I had to go though the great joys of engine replacment on my 4th gen 4Runner
read the fun HERE!. I initially planned on rebuilding the engine but found that there was too much internal damage to make rebuilding the engine cost effective (even though I was doing all of the work myself). Fortunately, someone on the site posted an
www.car-part.com to find engines in my area. I did have problems where the first engine turned out to be no good (crank damaged in wreck) but the junk yard replaced the engine. I was looking for 4th gen motor so I was able to find motors with very few miles. The first motor (the one with the bent crank) had only 7k miles. I wouldn't expect to find so few miles on a 3rd gen motor but you should excellent link for finding parts through 'junk yards'. I used the still be able to find out the milage on the motor. Also, I included in my posting a total cost for the engine replacement. I paid $2250 for the motor. The total cost was around $2700. It also took me around 4 months total because I did the work myself, I was looking to rebuild the motor rather than replacing, I didn't have the service manuals when I started, and the first replacement motor had the bent crank.
I've gotten 30k miles out of the replacement motor and it runs great. It required more work to install my own junkyard motor but I could not have done it much cheaper. I also am happy with the results. I wouldn't have done a cheap job.