I believe Buurin is correct - the 8th gen Corollas (1998-2002) use the C59 transaxle. It is related to the other Cxx family of transaxles - but the C59 is designed (bolt pattern) for the 1ZZ-FE engine. The C50/C52 was setup for the A-seried of engines (4AFE/7AFE, etc.) - 7th generation Corolla and earlier, some MR2.
Need a bit more information - does the shifter only pop out of gear under acceleration? How about deceleration? Only 5th gear? Does the shifter seem to move an excessive amount? How does the shifter "feel" - lot of slop in there, hard to find gears, etc.
Without seeing it, could be a number of things. Sometimes it is simple as a shifter cable adjustment (linkage is out of adjustment) or the shifter fork itself is loose or the shifter bushing itself is worn out (bushing on the "ball" end of the shifter). Worse case, could be your input shaft bearings and/or intermediate/thrust bearings are shot and possibly chipped teeth as a result. That would definitely mean rebuilt or replacement transaxle.
2002 Toyota Corolla S, 1.8L 1ZZ-FE VVT-i
2003 Toyota Matrix XRS, 1.8L 2ZZ-GE, VVTL-i (RIP)
2009 Toyota Matrix XRS, 2.4L 2AZ-FE VVT-i
2009 Toyota RAV4 Limited, 2.5L 2AR-FE Dual VVT-i