I'm a teacher too, but in my state you can only buy "service years" if you were an employee who was "away" for a time period. For example, if you were an employee but took off a semester to have a baby -- but were always "on the rolls" during that time, just not receiving a paycheck /not contributing to the pension fund -- you could "buy back" that semester. Or if you were a National Guard person who was called away for a year, you could "buy back" that year. You cannot just decide that you'd like to be 5 years closer to retirement and buy 5 years.
I think it's also fairly expensive. I only know one person who's done it.
The right answer for you is simple: Check into it with your own state so you'll know what your options are.
Working away from your actual question, here are some suggestions from a fellow teacher:
Ours is a career in transition. I'm much further down the road than you are, and my generation has definitely been surprised by these changes: We "bought into" this career believing that we'd have a low paycheck but good benefits and a secure modest retirement -- well, the paycheck has remained low, but the benefits have been whittled away ... and we're looking at BIG changes in the retirement soon. Those of us who are "old timers", who are fully vested in the program, we're fine. But next year -- or maybe the next? -- our state is leaving the defined benefit program for a defined contribution program ... which means our newest teachers are no longer going to be in the pension program. As a young teacher, this should concern you: If you change districts, or if you take a leave of absence and disconnect yourself from the system ... you'll come back in under the new program, meaning no pension.
Again, ours is a career in transition. When I started teaching, I never imagined anything except standing in front of students in my own classroom. Now I am teaching "blended classes", which means my students are with me one day ... and the next day they're at home working on lessons I designed /placed on the internet. Other teachers are teaching online classes, and they've literally never laid eyes on their students. I'm not convinced these are in the student's best interest, but they are the way of the future. And that doesn't even touch the concept of charter schools. Options exist for you that I couldn't have imagined when I was your age -- and as a young teacher, you need to ride the wave of these changes -- me, I have one foot out the door and don't care to embark on something entirely new. You might find some of these easier than a traditional career.
One last thing: In my experience, about 2/3 of all teachers don't really think much about retirement. Rather, they seem to think, "I have my pension. It'll all work out for me." You're wise to be in the 1/3 that is planning. Teaching has definitely been a good financial choice for me; partially because my husband has a completely different job, and our jobs compliment one another well -- he earns more money but has less security; my work schedule saved us thousands in after-school care and summer care, and has greater security.