Surprisingly, we have very few rules in our household or even fewer troubles.
We just talk, talk, talk, and encourage thinking.
Tell him what your family goals are. I think that mine are having a healthy, happy, safe, and successful family. See if he agrees with these goals or if he thinks anything needs to be amended. Assuming he agrees, you can see if his behavior supports these goals.
For instance, what are the possible repercussions of giving out the phone number? Perhaps you could look up the information on the Internet and explain that sometimes bad people will try to get information out of kids to harm them, together, find out what people can find out about you (check out Spokeo and other such sites - if you haven't denied access recently, do so now.) Chances are that you may turn green when he realizes that he may have not only given a phone number but access to other "private" information such as an address that a bad guy could use to harm him or the family. This did not keep the family safe. Once he sees the reason for the rule, he should follow it.
Let him know that you want to meet his friends and to keep him safe. Everything can reference back to the family goals.
Help him make his own rules to be successful. For instance, bedtime during school. Help him create a bedtime that helps him be successful. Help him look into the things that impact his bedtime: How long does it take him together ready? (if he wants to sleep later, can he do something ahead of time to shorten him bedtime routine.) How many hours does he need to sleep to wake up feeling great (again, you can help him do research about hw much sleep a thirteen year old boy needs.) He won't fight you about bedtime if he is the one who decided when it should be - of course, you can discuss some flexibility. After all, we adults sometimes stay up past our bedtimes too.
If he is used to not being accountable to the family, you may have to explain why you want him to do certain things such as always letting you know where he is, checking in If he might be late, and letting you meet his friends before he can hang out. You can tell him that it is for his safety or even just for your peace of mind (after all, you knw that he is a great good who generally makes wise decisions.) you may have to assure him that he will have total freedom at some point, but you may not give it to him as quickly as he wants it - that's just your job as a parent. You want to keep them safe and not give him more freedom than he can handle. If he protests, give him a hug and let him know that parents and kids are supposed to have some struggles - otherwise, why would they ever want to leave home. At least you can talk about them.
PS. If you didn't think talking was punishment enough, I've been told, "Just give me a spanking. I don't want to have to talk about it and think about what a stupid thing I did."
This is not written terribly eloquently, but it is hard to put 20 years experience into a few paragraphs.