Williamson was born and educated in St Andrews. He was first called to the West Kirk in 1661 but his support for the Covenanters led to his ousting in 1665 and his denouncement as a rebel in 1674. During his time as an outlaw, he escaped capture many times, most notably by hiding in bed with Jean Kerr of Cherrytrees, who became the third of his seven wives. This event is commemorated in the traditional song "Dainty Davie". Williamson also served as a commander in the Battle of Bothwell Bridge. Williamson returned to the West Kirk at the Revolution and remained until his death in 1706.