Miles was born in Westminster, Massachusetts, on his family's farm. He worked in Boston and attended night school, read military history, and mastered military principles and techniques, including battle drills.

Miles played a leading role in nearly all of the Army's campaigns against the American Indian tribes of the Great Plains. In 1874–1875, he was a field commander in the force that defeated the Kiowa, Comanche, and the Southern Cheyenne along the Red River. Between 1876 and 1877, he participated in the campaign that scoured the Northern Plains after Lt. Col. George Armstrong Custer's defeat at the Battle of Little Big Horn and forced the Lakota and their allies onto reservations. In the winter of 1877, he drove his troops on a forced march across Montana and intercepted the Nez Percé band led by Chief Joseph. For the rest of Miles' career, he would quarrel with General Oliver O. Howard over credit for Joseph's capture. While on the Yellowstone, he developed expertise with the heliograph for sending communications signals, establishing a 140-mile-long (230 km) line of heliographs connecting Fort Keogh and Fort Custer, Montana in 1878.[3][4] The heliographs were supplied by Brig. Gen. Albert J. Myer of the Signal Corps.[5]

In 1886, Miles replaced General George Crook as commander of forces fighting against Geronimo in the Department of Arizona. Crook had relied heavily on Apache scouts in his efforts to capture the Chiricahua leader. Instead, Miles relied on white troops, who eventually traveled 3,000 miles (4,800 km) without success as they tracked Geronimo through the tortuous Sierra Madre Mountains. Finally, First Lieutenant Charles B. Gatewood, who had studied Apache ways, succeeded in negotiating a surrender, under the terms of which Geronimo and his followers, agreed to spend two years in a Florida reservation. Geronimo agreed on these terms, being unaware of the real plot behind the negotiations (that there was no intent to let them go back in their native lands.) The exile included even the Chiricahuas who had worked for the army, in violation of Miles' agreement with them. Miles denied Gatewood any credit for the negotiations and had him transferred to the Dakota Territory. During this campaign, Miles's special signals unit used the heliograph extensively, proving its worth in the field.[5] The special signals unit was under the command of Captain W. A. Glassford.[5] In 1888, Miles became the commander of the Military Division of the Pacific and the Department of California

In April 1890, Miles was promoted to major general in the Regular Army and became the commander of the Military Division of the Missouri. That same year, the last major resistance of the Sioux on the Lakota reservations, known as the Ghost Dance, brought Miles back into the field. His efforts to subdue the Sioux led to Sitting Bull's death and the massacre of about 300 Sioux. This included women and children at Wounded Knee on December 29, 1890. Miles was not directly involved at Wounded Knee and was critical of the commanding officer. Just two days after the event, Miles wrote to his wife, describing Wounded Knee as "The most abominable criminal military blunder and a horrible massacre of women and children".[6] After his retirement from the Army, he fought for compensation payments to the survivors of the massacre. Overall, he believed that the United States should have authority over the Indians, with the Lakota under military control.

After the surrender of Santiago de Cuba by the Spanish, he personally led the invasion of Puerto Rico, landing in Guánica in what is known as the Puerto Rican Campaign. He served as the first head of the military government established on the island, acting as both head of the army of occupation and administrator of civil affairs.

Upon returning to the United States, Miles was a vocal critic of the army's quartermaster for providing rancid canned meat to the troops in the field during what was known as the Army beef scandal.

He was promoted to the rank of Lieutenant General in 1900 based on his performance in the war.

Called a "brave peacock" by President Theodore Roosevelt, Miles retired from the Army in 1903 upon reaching the mandatory retirement age of 64. A year later, at the Democratic National Convention, he received a handful of votes. Upon his retirement, the office of Commanding General of the U.S. Army was abolished by an Act of Congress and the Army Chief of Staff system was introduced.

When the U.S. entered World War I in 1917, the 77-year old general offered to serve, but President Wilson turned him down.[citation needed]

Miles died in 1925 at the age of 85 from a heart attack while attending a circus in Washington, D.C., with his grandchildren. He was one of the last surviving of those who served as a general officer on either side during the Civil War[7] He is buried at Arlington National Cemetery in the Miles Mausoleum. It is one of only two mausoleums within the confines of the cemetery.

^Warner, pp. 323-24, states that Miles was the "last survivor of the full rank major generals of Civil War vintage" and of all general officers, was outlasted only by John R. Brooke (died 1926) and Adelbert Ames (died 1933).