I think that you are talking about what happens in Act II, Scene 1. In that scene, Ariel uses magic first to put Gonzalo and Alonso to sleep and then to wake them back up. In both cases he does it with magical songs and music.
Ariel puts them to sleep because Prospero wants the others (Antonio and Sebastian) to start plotting to kill the king. He then wakes them up so that Gonzalo and Alonso will see what horrible people the others are.
When they realize this, they will be more ready to give Prospero his city back when they see him later on.