First, download a free copy of the 1999 factory service manual (thanks to member GaryDoug):
MediaFire is a simple to use free service that lets you put all your photos, documents, music, and video in a single place so you can access them anywhere and share them everywhere.
P0102 - MAF Sensor Low Frequency - The MAF sensor is critical to achieving the correct air/fuel ratio. Could easily be related to the stalling.
P0171 - Fuel Trim System Lean Bank 1
P0174 - Fuel Trim System Lean Bank 2
Both these codes tell you that the engine is running lean, and the PCM cannot supply enough extra fuel (based on O2 sensor feedback) to keep the engine from running lean. There are many possible causes related to this problem, and simply replacing the O2 sensors is not necessarily the "fix". You need to look over the codes in the factory service manual (FSM) and review the "Diagnostic Aids" section, listing many of the possible causes. If the MAF sensor is under reporting mass air flow, the PCM will not be able to calculate the correct amount of fuel to add, to correct the lean condition.
P0401 - EGR Flow Insufficient - If you review this code in the FSM (factory service manual) is can be caused by a faulty MAP sensor. The PCM cycles the EGR valve to test it, and looks at the change in MAP readings to tell if the EGR flow is correct. The problem can also be caused by wiring and terminal damage. Have you investigated the MAP sensor and the EGR wiring?
Why did you mention the windows and radio? While they may have problems caused by the body control module (BCM) the have nothing to do with the powertrain control module (PCM). They will not cause the problems you are experiencing.
Why do you suspect the throttle body? Yes, the complex electronic throttle body first used in 1999 3.8L models can cause a poor running engine, there are many diagnostics and codes for the system (TAC module and throttle body) but you don't have any of those codes. The MAF sensor is mounted in the throttle body though