Contact your professors. You may not think that they will remember, but there's a good chance that they will. Regardless, professors keep records of grades that will help them evaluate whether they can write a helpful letter on your behalf. We're used to hearing from former students years after graduation. So although it may seem as if it's a long shot - it may not be as difficult as you think.
What if your professor has left the institution? Contact the department and request contact information, an email address. Run an Internet search on the professor's name. The professor will be easy to find if he or she is working at another institution. If the professor is retired, try sending an email to his or her university email. Many professors hold on to university email accounts and check them.
When you contact the professor, mention what classes you've taken, when, what grades you earned, and any thing that might help him or her remember. Be sure to give the professor enough information to remember you and to write a good letter. Send your CV, copies of papers you've written for his or her classes, and the usual materials.
After 5 years, you should also consider including a letter from someone who is in a position to evaluate your capacities now. Can an employer or colleague write about your work habits and skills? Remember that your colleague is to write about his or her knowledge of you in a professional context, discussing relevant skills such as reasoning, problem solving, communication, time management, and so on.
Another alternative is to enroll in a graduate course (as a non-matriculated, or non-degree-seeking student), perform well, and then ask the professor to write on your behalf.