The home side had been wobbling on 168 for 5 but a sixth-wicket stand of 107 transformed the innings