H.W.
The best way to handle this is to have him return it to his friend with an apology. This, to me, is far more instructive and a very grave consequence-- in short, in my book, punishment enough. My feeling is that if you add any other adult-designated punishment (loss of privilege, etc), he can go from being remorseful and embarrassed and learning to just being mad at you for 'being mean'.
Does this mean that you are allowing the stealing? No. Condoning? No. You are teaching him that he has made a mistake and that he must make amends. So, keep your talk short and sweet. "You know you took the hat, it's not yours. You will need to return it and apologize." Either coordinate with the other child's mom so you can do it in person at their home over the weekend (or holiday-- if school is closed, I wouldn't let this drag out.), or call her and ask if she can come in with her child a little early if that is possible. I say this because this was what I did when my son 'accidentally' took some toys from school home and he needed to return them. The point is not to create an embarrassing or humiliating situation; the point is to create a contained experience he can learn from.
Then, when it's all over, tell him that if he wants extra items from what he has, he can earn money for them by doing extra jobs for you. This way,he has a reasonable option for 'what to do when tempted next time".
Let me also add that I stole something from a classmate in fourth grade and just having to return it was a most horrible moment. It completely curbed me of doing it again, and of shoplifting as a teen when my friends were-- I did not participate. It's a good lesson if we don't make the punishment worse than the returning of the item and the apology.
You may also want to let your daycare provider/teachers know that your son is pretty tempted right now and that they should keep an eye out.