The Taliban-claimed blast happened as the bus entered a police compound in the Wardak provincial capital of Maidan Shar, provincial police spokesman Hekmatullah Durrani told AFP.
Six bodies and 31 wounded had been taken to hospitals in the city, health director Salim Asgharkhil said.
Provincial governor spokesman Abdul Rahman Mangal confirmed the death toll.
In a WhatsApp message, Taliban spokesman Zabiullah Mujahid said "tens of Afghan police and soldiers were killed" in the attack.
The latest assault by the Taliban comes amid a flurry of US-led diplomatic activity to convince the group to negotiate an end to the 17-year war.
In an apparent move to aid tentative talks, top Taliban commander Abdul Ghani Baradar has been released by Pakistan after more than eight years in detention, sources said Thursday.
That came less than two weeks after US envoy Zalmay Khalilzad met with the Taliban's representatives in Qatar to discuss ending the Afghan conflict.
The Taliban had demanded the release of Baradar and several other senior leaders in the direct talks with Khalilzad on October 12, a high-ranking member of the group told AFP on the condition of anonymity.