Hello, I'm Cam. Please include all the details about your issue so I can accurately advise you. I cannot see your vehicle so please be detailed.
did you replace the fuel filter?
Ok, start there, replace the fuel filter and see if the old one is plugged. If so then you likely will need a new fuel pump as well.
sometimes i can drive for quite a while a while before it stalls
Yes, that is typical.
the fuel pump was replaced about a year ago with a new connector and also the filter was replaced at the same time
Ok, check it anyway.
any other ideas if that isn't the problem
Stalling like that, there is the off chance it is the ground wire under the drivers door on the frame or the crank shaft sensor.
ya the crank shaft sensor has been replaced
Ok, check the grounds and the fuel filter and lets see.
If possible, test the fuel pressure as it stalls to see what it is doing