For my 1997 Pickup XE, it was a slightly broken wire on the connector to the MAF sensor. That's why when the problem first started presenting itself, it was random event. But when the wire finally gave way, at which point only a few strands of copper were entact, is when the engine quit running properly. If I didn't have a diagnostic tool to alert me that it was the MAF Sensor, I would have never found the source of the problem because the broken wire was so obscure, and still hanging by a few threads, that upon 'looking things over', I would have never seen the cracked wire housing. The image here shows it after I dissected everything, and had to figure out a repair for the harness connector. The problem was not having access to the metal connector pin found in the harness connector. So I had to carefully open it up the tabs, splice a piece of wire in.
This was from 2011. Today, it's still purring like a cat.
Also, when you remove the MAF Sensor, be careful not to damage the rubber O-ring. Mine was dried out, and a replacement was nowhere to be found. I had to make do with one from a hardware store that was smaller diameter, but fatter, so when stretched over the sensor, it fit. Make sure you apply a non-petrol based lube to the oring before reinserting so as to not damage the seal.
As for the harness connector, you'll just have to search junk yards for any Nissans that might use that MAF and or connector.
Photos from the project: