I have an 05 Nissan sentra...as I'm driving it just dies...engine shuts off..radio and lights stay on just engine stahls out randomly..it progressively got worse then the car wouldn't turn on...thinking it was the fuel pump i replaced it..then car turned in just fine and work great, for a little..then just kept turning of as I'm driving or at a stop...sometimes after 5 min or 20mins..any idea what this is? A code turned up as p1138 swirl valve but I have no clue what that is
..please help! Thank you!

swirl valve is inside the engine hydraulically activated. Odds are you have a cam problem in the engine , VERY expensive to fix. Me, I'd ditch it rather than get into rebuilding that poorly made little engine. Get a good used toyota instead, they don't have such problems.