My 97 grand prix did something very similar when I was 17, I didn't know ANYTHING about cars... so I took it to a local garage thinking it'd be cheaper than a dealer.. they told me mass air flow sensor.... had my car for 9 days trying to find the problem. and then finally charged me $921 for the service and parts.... FML.
This is why I now read forums and post my problems here before a garage even knows I exist.