I got a check engine light for mass air flow sensor. Tried cleaning it but ended up changing it out. The truck ran terrible. Low idle and stalling. The light came back on and the truck started running normally again. Any ideas?
Are these the codes from before replacement or after? I am assuming you reset the codes after replacement. If you disconnected the negative battery terminal to clear the codes start the engine and let it idle for at least 10 min before you do anything else. This will give it time to re-tune. If these are not the codes that came on after replacement and clearing, if the CEL came back on, get the current codes read.
Next common issue.. did you use an aftermarket MAF Sensor? If you did, go back and get a Toyota branded one or the Hitachi (OEM) MAF sensor first. Other important things, check over your intake and vacuum lines for any leaks and repair/replace. A lot of times the problem is that the intake is sucking in air that is not being metered/measured by the MAG.
If you have an aftermarket intake put the factory one back on.
Anything else installed at the MAF like a "performance" chip (LOL) remove it.