He was a Gentleman and later Priest of the Chapel Royal and was subsequently a Minor Canon of Canterbury, Vicar of Littlebourne in Kent, Subdean of St Paul's and Prebendary of Lincoln.
From a letter written by Thomas Purcell, and still extant, we learn that this anthem was composed for the exceptionally fine voice of Gostling, then at Canterbury, but afterwards a gentleman of His Majesty's chapel.
In thankfulness for a providential escape of the King from shipwreck, Gostling, who had been of the royal party, put together some verses from the Psalms in the form of an anthem, and requested Purcell to set them to music.
The work is a very difficult one, including a passage which traverses the full extent of Gostling's voice, beginning on the upper D and descending two octaves to the lower.
[4] One of the important sources for Purcell's music is the Gostling Manuscript, a collection made by Gostling in 1706, which contains sixty-four anthems: seventeen by Purcell, twenty-three by John Blow, three by Matthew Locke, four by Pelham Humfrey, four by William Turner, and one by William Child, one by Henry Aldrich, three by Thomas Tudway, four by Jeremiah Clarke, Isaac Blackwell and a few others.