On 27 November 1786 Burns borrowed a pony and set out for Edinburgh. On 14 December William Creech issued subscription bills for the first Edinburgh edition of Poems, Chiefly in the Scottish dialect, which was published on 17 April 1787. Within a week of this event, Burns had sold his copyright to Creech for 100 guineas. For the edition, Creech commissioned Alexander Nasmyth to paint the oval bust-length portrait now in the Scottish National Portrait Gallery, which was engraved to provide a frontispiece for the book. Nasmyth had come to know Burns and his fresh and appealing image has become the basis for almost all subsequent representations of the poet. In Edinburgh, he was received as an equal by the city's men of letters—including Dugald Stewart, Robertson, Blair and others—and was a guest at aristocratic gatherings, where he bore himself with unaffected dignity. Here he encountered, and made a lasting impression on, the 16-year-old Walter Scott, who described him later with great admiration:
His person was strong and robust; his manners rustic, not clownish, a sort of dignified plainness and simplicity which received part of its effect perhaps from knowledge of his extraordinary talents. His features are presented in Mr Nasmyth's picture but to me it conveys the idea that they are diminished, as if seen in perspective. I think his countenance was more massive than it looks in any of the portraits ... there was a strong expression of shrewdness in all his lineaments; the eye alone, I think, indicated the poetical character and temperament. It was large, and of a dark cast, and literally glowed when he spoke with feeling or interest. I never saw such another eye in a human head, though I have seen the most distinguished men of my time.—Walter Scott
The new edition of his poems brought Burns £400. His stay in the city also resulted in some lifelong friendships, among which were those with Lord Glencairn, and Frances Anna Dunlop (1730–1815), who became his occasional sponsor and with whom he corresponded for many years until a rift developed. He embarked on a relationship with the separated Agnes "Nancy" McLehose (1758–1841), with whom he exchanged passionate letters under pseudonyms (Burns called himself "Sylvander" and Nancy "Clarinda"'). When it became clear that Nancy would not be easily seduced into a physical relationship, Burns moved on to Jenny Clow (1766–1792), Nancy's domestic servant, who bore him a son, Robert Burns Clow, in 1788. He also had an affair with a servant girl, Margaret "May" Cameron. His relationship with Nancy concluded in 1791 with a final meeting in Edinburgh before she sailed to Jamaica for what turned out to be a short-lived reconciliation with her estranged husband. Before she left, he sent her the manuscript of "Ae Fond Kiss" as a farewell.
In Edinburgh, in early 1787, he met James Johnson, a struggling music engraver and music seller with a love of old Scots songs and a determination to preserve them. Burns shared this interest and became an enthusiastic contributor to The Scots Musical Museum. The first volume was published in 1787 and included three songs by Burns. He contributed 40 songs to volume two, and he ended up responsible for about a third of the 600 songs in the whole collection, as well as making a considerable editorial contribution. The final volume was published in 1803.