Before becoming a NASA pilot, Gray had served as a Naval Aviator. He joined the U.S. Navy in July 1969 and earned his wings in January 1971. He was assigned to fly F-4 Phantoms at Naval Air Station Miramar. In 1972 he flew 48 combat missions in F-4s in Vietnam while assigned to VF-111 aboard the USS Coral Sea. After making a second cruise in 1973, Dick was assigned to Air Test and Evaluation Squadron Four (VX-4) at NAS Pt. Mugu, as a project pilot on various operational test and evaluation programs. He served as chief test director for the AIM-7F Sparrow in 1975-76 before being assigned as an F-14A project pilot on the Air Combat Evaluation/Intercept Missile Evaluation (ACEVAL/AIMVAL) program. He was also the chief test director for the operational test and evaluation of the television sight unit and the dual-seat visual-target-acquisition system in the F-14A. In 1978 he was assigned back to VF-111 at NAS Miramar as an F-14A pilot