There could be any number of reasons why it's struggling - poor connections to sensors (dirt/corrosion, often made worse by pressure washing the engine bay), even loose/dirty battery terminals. Cracks in the fuel hoses can allow air into the system (air will enter the hose before diesel will come out) and if that is happening between the filter and the pump there's a good chance the pump is sucking gobs of air. Find this sort of leak by overpriming the system (10-15 good squeezes of the primer). Don't do it over lawn, it'll kill the grass.