Worcestershire lost three quick wickets after being set a 352 target in 63 overs by Gloucestershire on the final day of the Specsavers County Championship clash at Bristol.
Brett D'Oliveira, Daryl Mitchell and first innings century-maker Joe Clarke were dismissed inside the first 14 overs.
But Moeen Ali remained firm and scored his second half century of the game from 62 balls with eight fours and a six.
By tea Worcestershire had moved onto 83-3 with Moeen unbeaten on exactly 50 and Tom Kohler-Cadmore 11.
Liam Norwell made the first breakthrough when he bowled D'Oliveira (4) and then the same bowler accounted for skipper Mitchell (8) in the same fashion after he shouldered arms.
Clarke (8) got off the mark with successive boundaries off David Payne but they were his only scoring shots before he was yorked by Josh Shaw to leave Worcestershire on 49-3.
Moeen looked in fine form and his first scoring shot was a sublime four through extra cover off Norwell.
A straight drive for four by Moeen at Norwell's expense brought up the 50 and he then took on a bouncer from the same bowler and picked up six runs over the head of Hamish Marshall.
Gloucestershire resumed on 217-6 with Chris Dent unbeaten on 81 and Jack Taylor eight after Matt Henry's three wicket burst had raised Worcestershire's hopes yesterday evening.
By lunch the home side had moved onto 357-6 from 98 overs – a lead of 326 – with Dent on 122 and Taylor 101.
The pair safely negotiated the remaining 10 overs before the second new ball was taken at 242-6.
Dent followed up his 180 against Derbyshire last week at Bristol by reaching three figures with two boundaries in an over from Ed Barnard.
The left hander went to three figures off 225 balls with his 13th boundary.
Taylor completed his half century off 69 balls with six fours. Mitchell rotated his bowlers but they were unable to make the breakthrough on what is still a good pitch.
The 100 partnership between Dent and Taylor was raised in 26.4 overs. Moeen Ali came into the attack and conceded 21 runs in his first over of the morning.
Taylor also completed his hundred in the final over before lunch via a six off Moeen. His ton came from 95 balls with two sixes and 12 fours.
The stand was broken shortly after lunch when Tom Kohler-Cadmore held onto a fine catch at mid wicket to dismiss Taylor for 105 off the bowling of Barnard. The partnership was worth 162 in 34.2 overs.
Dent ended undefeated on 138 from 272 balls with 19 fours when the declaration came at 382-7 from 101 overs.
Henry finished with 3-83, Joe Leach 2-77 and Barnard 2-73.