Had similar problem with my Prado 96 1KZ-TE. It won't go into O/D. Did following things:
0- Check DTC... mine was giving O/D code 61, which means problem with speed sensor 2 or ECM.
1- Tried resetting the Electronic Controlled Diesel (ECD). Take out the ECD fuse or disconnect batteries. After resetting ECD... Car would shift into 4th gear but problem kept coming back.
2- Changed the Speed Sensor 2 but it did not fix the problem
3- Checked ECM circuit for Speed Sensor 2 and it seemed OK
4- Talked with some random auto electrician in Rawalpindi - Babu Autos in Marir, and the guy put in a diode in ECM wires and it fixed the issue. So my issue seemed to be related to ECM, some capacitor gone bad or something.