Gregg commanded the cavalry division that remained near Petersburg while Sheridan was engaged in the Shenandoah Valley Campaign against Jubal Early. In his role as cavalry commander, Gregg screened various union movements in the Siege of Petersburg. Gregg's division was particularly engaged at the Second Battle of Deep Bottom, the Second Battle of Ream's Station, and the Battle of Peebles' Farm. Near the end of his service, he was promoted to the brevet rank of major general.