Only replace defective parts. Follow the troubleshooting guide in the FSM or search here for P0401 for testing guidance. The potential culprits include the VSV, the valve, the modulator, vacuum hoses, temp sensor, wiring and clogged passage especially in high mileage vehicles.
...and if you follow the FSM and troubleshoot the EGR parts; and still have the CEL, there are those who suggest replacing the O2 sensors are the issue. I'd suggest starting with the FSM. It's possible the Toyota techs that wrote it know more than me. (Quite possible.)
I'm going to go against Pin_Head on this one and suggest a different tactic. When we do preventative maintenance we always promote changing all the hoses, all the belts, all the filters, all the fluids etc. When we have to do various replacements there are always "while we are there" components that could be replaced merely because you are right there. Add into the mix a high mileage vehicle plus the fact you are not the original owner and highly likely have no clue to its previous life, and now you have all the reasons you need to replace components with new regardless if they are defective or not.
EGR valves go bad. Modulators go bad. The wiring harness gets burned. Vacuum hoses get brittle. VSVs stop working. O2 sensors go out of spec. So sure you could sit and play detective like EVERY single one of us with the same 401 code and have the satisfaction of saying you figured it out unlike everyone else who struggled like a mofo. Oooooor you can spend a little more money and just replace with new OEM and have the piece of mind of knowing that everything is brand new and that stupid 401 isn't coming back anytime soon.
Will you definitively know what caused the 401 if you replace all the culprits? Likely not but who cares? It's an issue that won't rear its ugly head for a very very satisfyingly long time.
Do a quick search and you'll find many fixes. I'm between pin head and nlxtacy, one is find the broken part and the other is replace EVERYTHING!
But we all know there are a few things that can go wrong to give you 401 and some things can't really be replaced. So here is what I did to get rid of my 401:
1. Replace ALL vacuum lines, cheap even with oem hoses
2. Clean temp sensor with wire brush, free
3. Clean that stupid little passage with a wire, free
4. Clean the passage in the throttle body through temp sensor hole with wire and TB cleaner
5. Replaced the modulator with a sub 10 dollar(shipped) ebay one
And no 401 for 6 months now!
You might have to replace more than I did but replace all rubber parts then follows by plastic parts one at a time, that's just my approach.
Although I do agree with nlxtacy when it comes to O2 sensors, just replace them!