Level up a Shedinja, and have a Pokemon having high defense and resistance to flying type attack.
Rayquaza only use fly (Flying), Extreme speed (Normal), Rest, and Outrage (Dragon). Shedinja's Wonder guard will help on most of the attacks. Use Confuse Ray to confuse Rayquaza and use Double Team to reduce the pobability of a direct hit form fly. If the fly succeeds in first, switch the Wall pokemon and take damage, then switch back and heal. Use Fury Cutter or Fury Swipe or any attack does damage to make more turns on the Rest. If Rayquaza started to use Struggle, use other Pokemon to lower its HP. After many turns, use Timer Ball for catch.
For Latios/Latias is easier since the only attack can affect Shedinja is Charm.