You need to review all the details of the Apple ID that is associated to your old phone. Make sure your phone number in particular isn't listed anywhere under the Apple ID that is currently in use on the old phone (you'll need to check this through apple.com to see the full detail, you won't see everything through the phone itself).
I had this happen re-using a phone from my wife, she started seeing my messages on some devices. Turns out I was using an Apple ID that had ended up with both her and my phone numbers listed under it. If you erased the phone but still had your SIM in it, your number could have ended up included in any new Apple ID created on the phone.