I'm going through a similar situation in a 2wd pickup. I have the A43D transmission and you have the A340 so I can't advise but I can guide you.
Look up the '93 Tacoma Factory Service Manual on the internet by searching: utulsa buchanan 93 FSM
Mr Buchanan was kind enough to upload it.
There's a section on the overdrive control for your transmission.
Mine is controlled by a thermo switch / relay / solenoid. Yours may be also.
My relay is on the upper firewall under the dash on the far left. It's blue.
I replaced my dead solenoid with a junkyard special and it snaps on and off like it's working but still no 4th gear

If I take it back out and it bench tests OK, I'll have to conclude that my 4th gear has failed (debris clogging valve body or failed plates). Good luck with yours.
Chris