why the engine idles up and down ? on 1997 Lexus LS400

when the car is in park the engine will idle up and down, in gear it runs smooth but at a high idle, I changed the mass air flow sensar. What is causing this please ?

Asked by for the 1997 Lexus LS400
You could have a vacuum leak, or something else that is effecting the air/fuel mixture. There is an idle valve that controls the idle speed, this valve or the circuit that controls it may be having problems.
I suggest you have this diagnosed before replacing any more parts though, the idle valve alone is over $500!
thank you for your answer,i brought to dealer they say ecm and short circit,i replace ecm,air mass sensor and whole engine still the same,please help