He became Viscount Dalrymple in 1703 when his father was created 1st Earl of Stair. In January 1706 he was appointed colonel of the Earl of Angus's Regiment. He commanded a brigade at the Battle of Ramillies in May 1706 and, having been promoted to brigadier general on 1 June 1706, became colonel of the Grey Dragoons on 24 August 1706. He became 2nd Earl of Stair in January 1707 when his father died and later that year he was elected as one of sixteen Scottish representative peers in the newly formed Parliament of Great Britain.