Gloucestershire battle in follow-on but face stiff final-day task