The Apollo 12 astronauts — Pete Conrad, Capt. Gordon and Alan Bean — smile aboard their recovery ship, the USS Hornet, upon their return to Earth in 1969. (NASA)

Richard F. Gordon Jr., an astronaut who tested the limits of human strength in space with a taxing mission during the Gemini 11 flight, and who later orbited the moon as the pilot of the Apollo 12 command module, died Nov. 6 at his home in San Marcos, Calif. He was 88.

The cause was cardiac arrest and complications from cancer, said his son Larry Gordon.

A former Navy aviator and test pilot, Capt. Gordon spent a total of 315 hours and 53 minutes in space during his Gemini flight in 1966 and the Apollo flight three years later.

Apollo 12 came four months after the Apollo 11 mission in which astronauts Neil Armstrong and Buzz Aldrin became the first human beings to touch the lunar surface. Capt. Gordon never had the opportunity to repeat their feat; as pilot he remained aboard the command module, dubbed the Yankee Clipper, while his colleagues Charles "Pete" Conrad Jr. and Alan Bean conducted NASA's second moon walk.

He recalled with fondness his rich friendship with his fellow Apollo 12 crew members. On Earth, they drove matching gold Corvettes. In space, they had an easy, jesting rapport. When Conrad and Bean returned after their moon walk, they were so coated in moon dust that Capt. Gordon — like the proud owner of a freshly waxed vintage car — exclaimed to them, “Holy smoke. You’re not getting in here and dirtying up my nice clean command module.”

Capt. Gordon sits astride the Gemini 11 spacecraft during a space walk in 1966. (NASA/AP)

"I made them strip, take every bit of clothes off they had," he said in a NASA oral history. "So they passed the rocks over, they took off their suits, passed those over, took off their underwear, and I said, 'Okay, you can come in now.' "

Capt. Gordon survived several hair-raising moments in his NASA career. The Apollo 12 craft was struck by lightning as it launched. Perhaps even more frightening was his earlier Gemini flight, also with Conrad, part of NASA’s effort to prepare for an eventual moon landing.

During a spacewalk, Capt. Gordon swiftly succumbed to fatigue brought on by the challenges of functioning in the weightlessness of space. His breathing became labored, and for a period he lost vision in his right eye because of the perspiration accumulating in his space helmet.

In the volume “Moondust: In Search of the Men who Fell to Earth,” author Andrew Smith wrote that only through an “immense act of will” did Capt. Gordon maneuver himself back close enough to the spacecraft for Conrad to pull him in. “Conrad,” according to Smith, “later said that of all the situations he faced in space, this was the one that scared him most.”

Capt. Gordon’s experience was credited with helping prepare future astronauts for their missions. He was scheduled to be commander of Apollo 18, a mission that NASA ultimately did not undertake because of lack of funding.

He never complained about his lost chance to touch a celestial body, although he did evince some wistfulness.

"The name of the game as far as I was concerned was to walk on the Moon. And at that time, I was relegated not to do that," he told NASA. "I had a job and a function to perform."

Richard Francis Gordon Jr. was born in Seattle on Oct. 5, 1929. His mother was a teacher, and his father held logging and other jobs.

Capt. Gordon considered becoming a priest or a dentist before becoming fascinated by aeronautics. “Man, has this been here all the time?” he recalled thinking after his first airplane ride. “I’ve got to get some more of this.”

He received a bachelor’s degree in chemistry from the University of Washington in 1951, then joined the Navy. He became a naval aviator and test pilot before being chosen for the space program in 1963. After his retirement from NASA and the Navy in 1972, he was an executive with the National Football League’s New Orleans Saints and in the oil and gas industry.

His first marriage, to Barbara Field, ended in divorce, and their son James Gordon died in 1982. His second wife, the former Linda Schultz Saunders, died in September after 36 years of marriage.

Survivors include five children from his first marriage, Carleen Trevino of Waynesville, N.C., Richard Gordon III of Jacksonville, Fla., Larry Gordon of Annandale, Va., Thomas Gordon of San Marcos and Diane Briggs of Fredericksburg, Va.; two stepchildren, Traci Shoblom of Long Beach, Calif., and Christopher Sjoblom of Winnemucca, Nev.; two sisters; a brother; 21 grandchildren; and eight great-grandchildren.

Conrad, Capt. Gordon's Gemini and Apollo colleague, died in 1999 in a motorcycle accident. Bean retired from NASA and became an artist, his works mainly featuring astronauts and the ethereal beauty of space.

The Earth is “the only thing out there that looks like that’s the place you ought to be because it exhibits a tremendous amount of fragility,” Capt. Gordon told NASA. “The sheer beauty of this planet is awesome. The blues of the oceans, the whites of the clouds and the khaki color, the appearance of the continent. It’s awesome. It really is.”

CORRECTION: An earlier version of this article referred to Capt. Gordon in one instance as Capt. Conrad. The article has been corrected.