Virginians elected Miller Attorney General of Virginia in 1969 to succeed Democrat Robert Young Button. In the Democratic primary, he received 151,833 votes and advanced to a runoff with Guy O. Farley, Sr., who had received 130,042 votes. In the runoff, Miller defeated Farley, Sr. by 256,453 votes to 149,699. In the general election, he faced Republican Richard D. Obenshain and Virginia Conservative nominee Flavius B. Walker, Jr. Miller won the election with 455,264 votes to Obenshain's 402,382 and Walker, Jr.'s 15,692. He was sworn in as Attorney General in January 1970 and re-elected in 1973 by a landslide, taking 662,568 votes to Republican M. Patton Echols, Jr.'s 276,383. In 1973, the Virginia General Assembly requested that he file suit against the Voting Rights Act. Miller duly did so. In 1976, he was awarded the Wyman Memorial Award, given to an "Outstanding American Attorney General." Miller resigned as Attorney General in January 1977 to run for Governor, as is the convention in Virginia. Thus, Anthony Francis Troy filled the office for one year, although never elected. Miller faced former Lieutenant Governor of VirginiaHenry Howell in the Democratic primary and, despite outspending Howell by a margin of 3-to-1, Miller was defeated by 253,373 votes to 239,735. Howell went on to lose the general election, taking 541,319 votes to Republican Lieutenant Governor John N. Dalton's 699,302. Republican J. Marshall Coleman was elected attorney general during the same election and took office in January 1978. Miller's final run for office came later in 1978. He was the Democratic nominee for the United States Senate, and was narrowly defeated by Republican John Warner, the former United States Secretary of the Navy. Warner had actually lost the Republican nomination to Richard D. Obenshain, whom Miller had defeated in the 1969 Attorney General election. However, Obenshain was killed in a plane crash while returning home from a campaign appearance, and the Republican leadership chose Warner to replace him on the ballot. Miller lost to Warner by 608,511 votes to 613,232. After leaving office, Miller "built a practice representing major energy companies before state attorneys general, including Southern Company and TransCanada, the entity behind the proposed Keystone XL pipeline." Miller, although a conservative Democrat, served on the transition team for newly elected Republican Attorney General Ken Cuccinelli in 2009. He also defended Cuccinelli's handling of the Star Scientific tax case after also receiving gifts from its chief executive. Miller was active in the National Association of Attorneys General, the Conference of Western Attorneys General, the Democratic Attorneys General Association, and also the Republican Attorneys General Association. Miller was selected as Chairman of the Southern Conference of Attorneys General, Chairman of NAAG's Antitrust Committee, and a member of NAAG's Executive Committee. He was the recipient of NAAG's Wyman Memorial Award. He established the John Marshall Foundation and was its first president.