The following year, with the arrival of American Commodore Matthew C. Perry and his fleet, the Shogunate increased military preparations against possible foreign invasion.
He further rose to the ranks of the rōju in June 1866, which enabled him to participate in negotiations between the Tokugawa Shogunate and the Imperial Court later that year.
He also encouraged the Shogunate to hire French military advisors to help modernize its forces, and to expand on his concept of a peasant conscript army to supplement the traditional forces of the samurai warriors, along with taking steps to increase industrialization to increase Japan’s economic strength.
Arrested as a central figure in the Tokugawa government by Satchō Alliance leaders, Matsudaira was given a chance to prove his loyalty by leading a military force against the Ōuetsu Reppan Dōmei in northern Japan.
In 1871, with the abolition of the han system, Ogyu was confirmed as appointed governor of Tanoguchi, until it was merged into the new Nagano Prefecture.
Ogyu died the following year, and was awarded the Order of the Rising Sun with Paulownia clusters posthumously.