To catch Rayquaza, travel to Pacifidlog Town, surf east, then head north to Sky Pillar. Complete the Mach Bike challenge inside, reach Rayquaza, and use Ultra Balls or a Master Ball. Save before the encounter so you can retry if needed.