Lay your portal on any nearby wall you like and you’ll reappear on the platform opposite the Companion Cube. Fire a portal at the wall right behind the cube and turn around to face the Cube.
Now be sure to pick it up and then drop down onto the ground and set the Cube down on any one of the red floor buttons.
Turn to your right and stick your head over the ledge and you’ll spot a Cube chilling out on its own. Fire a portal over it and it’ll drop down onto the platform to your left.
It’ll reappear on the platform up and to your left, so fire another portal off on a nearby wall and you’ll be able to pick the second Companion Cube up and drop it down on the final red button, in turn, opening up the exit.
Wondering where to go in the exit? Simply drop a portal by your feet and you’ll drop through the roof above. Walk up the broken glass and take the left towards the lift to the next test chamber.