The invention discloses a kidney-tonifying yang-invigorating pill for treating erectile dysfunction and a preparation method thereof. The pill is prepared from the following raw materials by weight: 10-15 parts of poria cocos, 5-10 parts of radix astragali, 10-15 parts of lucid ganoderma, 12-18 parts of angelica, 15-20 parts of herba epimedii, 10-15 parts of herba cistanche, 16-22 parts of polygonum multiflorum, 15-20 parts of semen cuscutae, 18-24 parts of radix rehmanniae preparata, 10-15 parts of caulis spatholobi, 5-10 parts of bitter gourd seeds, 10-15 parts of Ilex cornuta leaves, 6-12 parts of sea horses, 8-14 parts of piper wallichii, 9-16 parts of red date, 12-18 parts of radix achyranthis bidentatae, 10-15 parts of fructus alpiniae oxyphyllae, 5-10 parts of medlar 10-15 parts of eucommia, 15-20 parts of fructus rosae laevigatae, 11-17 parts of Chinese chive seeds, 14-18 parts of Chinese yam, 16-22 parts of radix bupleuri, 10-15 parts of radix curcumae, 5-10 parts of white peony roots, 12-16 parts of luffa seeds, 5-10 parts of morinda officinalis, and 10-15 parts of gigantism rhodobryum herbs. The kidney-tonifying yang-invigorating pill provided by the invention has the effects of tonifying kidney and tonifying qi, securing essence and invigorating yang, nourishing blood and promoting essence generation, invigorating blood circulation and freeing the collateral vessels, soothing the liver and resolving depression, building body and strengthening body health, has significant effect on treating erectile dysfunction, has definite effect, quick effect, and high cure rate, causes no adverse effect or toxic or side effects in clinical practice, is safe and reliable, and can cure erectile dysfunction fundamentally.