I have a p0171&0301. Why does my truck run ok after it warms and then sits? on 2001 Ford Ranger

When my truck warms up I can shut it off and let it sit for about 15-25 minutes; then it will start, idle and run fine for about 2 minutes and then it will start misfiring again. Why does this happen? Also I can take my gas cap off without any check engine light coming on.

I think it could be the evap system because it seems like the fuel vapors build up or something allowing the fuel/air ratio to be higher at startup. I'm not quite sure but maybe the evap canister vent solenoid is bad without throwing a code.

Can someone please help me out with this? Thanks.

Work already performed:
-plugs and wires
-coil pack
-evap purge valve
-EGR valve and sensor
-IAC valve
-cleaned throttle body
-cleaned MAF
-fuel pump/filter
-PCM relay
-fuel pump relay
-PCV valve and fixed hose
-oxygen sensor, bank 1 upstream

Asked by for the 2001 Ford Ranger
Is it Flex Fuel? Had some flex fuel sensor problems, same symptoms! Check intake manifold for vacuum leaks!!! Warm up intake seal, cool down intake leak.
No flex, just gas. Do gaskets swell when hot and then with engine off under no pressure it would seal the leak? It has no leak or misfire for a little bit after restart.