VERY FIRST thing to do is make sure there is fuel in your car (IGNORE WHAT THE GAUGE TELLS YOU!!!) i know this sounds rediculous but i have overlooked this numerous times
next thing to do is check if the codes have been stored by the cars PCM..... then go from there. otherwise-
check the TPS for voltage, note it is a variable resistor so the voltage should change with the position of your throttle.... i believe idle is .05v or somthing to that extent
then go over the usuals with this model car.... ecspecially the idle components (IACV, FITV, EGR, etc) i would remove the egr, clean it(replace if staying open) remove carbon deposits etc.... dont forget to check all vacuum lines associated
check the ignition side as well (plugs, wires, cap and rotor) arcing could be present cause a short to ground aka misfiing..... however usually a ruff idle is associated with the EGR, fuel , and ignition.
check the fuel pressure regulator (35psi at idle- aprox. 42psi full throttle) check the vacuum line coming out of it, is there fuel coming out of it? if so, REPLACE IT.
the relay could be losing contact or the fuel pump could be "dying" jump the relay to the fuel pump and see if it continues to cause problems....
if nothing above fixes it..... i would recommend replacing the fuel pump. since this is the most likely cause. a fuel pump can sound like it is running but jump windings when under demand(heat) causing it to shut down....