If it's rocking side to side, don't just load it up with more books and hope it settles - that'll only make it worse. The issue is almost certainly a combo of loose joints and lack of lateral support, not one thing on its own.
Before you anchor it to the wall (which is probably where you'll end up anyway), pop the back panel off and check those wooden dowels where the frame pieces slot together - they're probably pretty loose after 15+ years. I had the exact same Billy from around that era, and when I finally got fed up with the wobble, I found the dowels had basically shrunk slightly and were just rattling around in their holes. You can try drilling them out and replacing them with slightly thicker wooden dowels, or wrapping the existing ones with a thin layer of wood filler or even sandpaper to make them tighter. Tighten any bolts holding the frame together too.
That said, if tightening the joints doesn't solve it completely, wall anchors are genuinely the right move - Billy shelves weren't really designed to be freestanding once they get older. Does the back panel feel warped or is it still flat? And how heavy are you planning to load it with books?