Honours were almost completely even at stumps on day two of Glamorgan's LV= County Championship Division Two clash with Gloucestershire at Cardiff.
Jim Allenby scored 85 for the hosts as they reached 271-9 in response to Gloucestershire's first-innings effort of 275 all out.
Gloucestershire had resumed their first innings on 228-8 and added a further 47 runs in almost 23 overs before Allenby (3-31) finally mopped up the tail.
Glamorgan then suffered a setback in their reply as they found themselves reduced to 47-3, Gareth Rees (7) edging Graeme McCarter into the slips, while Ben Wright (0) and Murray Goodwin (14) also failed to get going.
But Chris Cooke and Allenby rescued the Welsh county from their shaky predicament, putting on 56 for the fourth wicket despite the latter being dropped early in his knock.
Cooke also played well in completing a 64-ball half century but, without adding any more runs, Matt Taylor (3-98) broke through his defences to leave Glamorgan on 103-4.
After tea, David Lloyd perished for 16 when he edged to Chris Dent at second slip off Will Gidman (4-64), who then had skipper Mark Wallace (7) caught behind.
But Allenby continued, completing a 68-ball fifty but falling 15 runs short of a century when he edged Taylor to Dent to give the slip fielder his fourth catch of the innings.
Ruaidhri Smith (39) was the ninth man out before Dean Cosker (19 not out) and Michael Hogan (16no) put on an unbeaten 27 for the final wicket by stumps.