Though folks think the phone is on contract, it is actually the phone line. Do whatever you want with the phone including selling it. You have to keep the "line" for whatever period you signed up for. On the other hand, if you signed for a program that requires you to return the phone, well.... return it.
Meanwhile - the whole upgrade thing has changed considerably. Check YOUR account online, especially if you have switch to any of the new plans.