Johnny Cade killed Bob Sheldon—not Ponyboy.
During the park attack, Bob was drowning Ponyboy. Johnny used his switchblade to stop him, acting in immediate self-defense of his friend. Johnny later feels immense guilt, but the killing was defensive, not aggressive.