Derbyshire 306 and 185 for 7 (Madsen 58, Godleman 43, Raine 3-24, Trevaskis 3-71) lead Durham 223 (Jones 87, Conners 4-55) by 268 runs
The 30-year-old paceman took 3 for 24 in 18 overs to restrict Derbyshire to 185 for 7 in their second innings, a lead of 268.
The visitors suffered a major blow after three overs of Derbyshire’s second innings when their leading bowler, Chris Rushworth, left the field with a muscle strain.
Given the state of the game and Rushworth’s injury, Durham did well to keep Derbyshire in check with Godleman and Luis Reece taking 23 overs to increase the lead by 50.
Reece did launch Trevaskis over the long off boundary before he was caught behind playing defensively at Raine who bowled a good containing spell from the City End.
Brooke Guest drove Trevaskis for another six but was caught at slip off the next ball as he tried to cut.
By lunch Derbyshire were 145 ahead and Godleman showed more intent after the interval, straight driving Trevaskis for six before Madsen completed yet another 50, his 11th of the season, by guiding Raine to the third man boundary.
Godleman was seven away from his first Championship half-century of the summer when he was caught on the crease by Raine to end a stand of 88 in 27 overs.
Durham struck twice in the next two overs with Leus du Plooy well caught by Nic Maddinson running back to long off and Madsen caught behind dabbing at Raine shortly before bad light stopped play.
Rain prevented a resumption until 4.40pm and Derbyshire’s slide continued with two more wickets falling in consecutive overs.
Harry Came’s attempt to drive Trevaskis over the top ended in the hands of cover and Mark Watt got a top edge aiming a pull at a ball from Paul Coughlin that stopped on him.
Anuj Dal and Ben Aitchison added another 24 from 67 balls before bad light ended play with 11 overs remaining at 5.30pm leaving the game intriguingly poised if the rain stays away on the final day.