On your arrival at the second floor of the Gym (first floor if you’re in Britain), you’ll notice that there is a clown here, as well as a pair of cocoons, one to either side.  Take a moment to go and battle the clown before trying to move on.

Battle: Harlequin Clarence (640 Poke)
Opponent: Sewaddle Lv 20, Sewaddle Lv 20

The cocoon on the left just leads you back to the ground floor again, so take the right-hand cocoon to keep ascending.  You’ll find yourself on a small platform that leads to a closed cocoon.  Try to run past it, and another clown will pop out to face you.

Battle: Harlequin Jack (640 Poke)
Opponent: Combee Lv 20, Swadloon Lv 20

Jack will move out of the way; step forwards and go through the cocoon he came out of to land back on the ground floor.  Once there, step around the cocoon you emerged from to the right and go for the other entrance.  A third clown will stop you for a battle.

Battle: Harlequin Gary (608 Poke)
Opponent: Sewaddle Lv 19, Dwebble Lv 19, Combee Lv 19

The cocoon you come out of has two entrances, but another clown waits here, so go and snag yourself a battle before considering any silk travel.

Battle: Harlequin Anders (640 Poke)
Opponent: Dwebble Lv 20, Swadloon Lv 20

With that done, you’re all clear to do as you like.  The side entrance to the cocoon you arrived through just brings you directly to the other cocoon on this floor, so head around it to the left instead and take the last unknown cocoon entrance to head right up into a huge mass of silk on the ceiling of the gym- the final cocoon, where Burgh waits for you.