This is rather common with Toyota 5S-FE and 1MZ-FE engines.You probably do not need to replace anythig at this moment.
It is most likely caused by excessive carbon deposite on the passage to and in the EGR valve to the intake manifold.To verify this, take off the intake hose to the intake manifold, open the throttle valve plate, use a good flashlight and see the hole in the intake to the EGR valve. You may see black carbon deposite partially blocked the hole.That's why your car has P0401.
If you take the car to a dealer, they may recommend to replace the EGR valve, EGR pressure regulator, and VSV for EGR. They will clean the hole in intake manifold to the EGR valve and those small rubber hoses. It will cost you a few hundrd bucks, and for sure you will not have EGR code problems for a few years.
If you want to do DIY,just get a repair manual, take the throttle body and EGR valve out, clean and remove the carbon deposite partially blocking the EGR valve and hole on the intake manifold to the EGR valve, air blow the rubber hoses, and then put them back as where they are bofore. The code should go away. If you have not cleaned it carefully and thoroughly, the code may come back very soon, i.e. in a few weeks. Also some loose carbon deposite remaining may block the small tubes on the valve later. Then you need to clean and open them.
Good luvk!