Steve Magoffin took five wickets before lunch to put Somerset on the ropes at Taunton but the hosts fought back to take the lead in their LV= County Championship Division One clash against Sussex.
The 34-year-old reduced Somerset to 39 for five, in response to 214, but half-centuries from Craig Overton and Craig Kieswetter helped the home side to recover and take a 75-run first-innings lead as they were all out for 289.
Magoffin, who has regularly terrorised Somerset since joining Sussex in 2012, added another wicket after lunch to take his overall haul against them to 36 in that time, but his return of 6-60 was not enough to stop the hosts from nudging in front.
Overton just missed out on his first ton, finishing on 86, but his impressive knock, which included nine boundaries, was vital to Somerset's revival.
Sussex finished on 26 without loss in their second innings at stumps to trail by 49 runs going into the third day.
Ed Joyce brought up his century at the start of the day with a four to add to his overnight 99, before Alfonso Thomas trapped him in front to leave Sussex on 214 all out.
Then Magoffin got to work. He bowled Marcus Trescothick for a duck with his second ball of the day to set the tone for a blistering opening session.
Johann Myburgh and Nick Compton (13) were next to fall, with both caught behind by Ben Brown as Somerset were in near-panic mode on 18 for three.
Magoffin was not finished there and trapped James Hildreth lbw, before Alviro Petersen was also caught behind as the Australian claimed his 400th first-class wicket.
At that point Magoffin looked unplayable with five wickets for just 13 runs, but Peter Trego and Kieswetter began a rebuilding job either side of lunch.
Kieswetter hit the shot of the day in the 24th over, smashing a six off Will Beer, before Somerset went for lunch on 92 for five.
After the restart, Kieswetter and Trego even started to find some joy off Magoffin, but not for long as their 86-run partnership was brought to an end when Trego became his sixth victim.
The 32-year-old was caught by Steffan Piolet at second slip for 27 and was soon joined by Kieswetter, who miscued Piolet's slower delivery and was caught for 65 by Matt Machan as Somerset were left on 125 for seven.
That could have heralded a collapse from the hosts, but Craig Meschede and Overton stood firm.
They piled on 81 runs together before Meschede, on 38, became Piolet's second victim courtesy of a fine one-handed catch from Luke Wells at extra-cover.
Overton then forged a 77-run partnership with Thomas, who made 38, but both men fell to Rory Hamilton-Brown in quick succession to wrap up Somerset's first innings.
Chris Nash and nightwatchman James Anyon got Sussex to 26 without loss in their second innings, with the match intriguingly poised going into the penultimate day.