Its because he got a few mins of deep sleep a while back when he used the sleeping jutsu to summon the badger demon.

Lack of sleep really does drive people crazy.

That and he realized his siblings loved him and helped him escape from the battle.

Now he seems normal again.