Just went through something similar with both our Subarus.
Might be the refrigerant level certainly worth checking out 1st. Kind of makes sense where you're getting good cooling for 2 hrs before it craps out.
Also check The AC Clutch. Is it engaging when the ac stops cooling? If it isn't Could be the magnet is getting past it or maybe the air gap has gotten to big and clutch needs re-shimming.
One of our Subies was was the AC relay (2nd time in 4 years) but only $12. The other one I ended up getting another compressor after eliminating everything else.
Damn, we're in a tight spot!
Bookmarks