The London museum already has a photograph of the musician on display and has now acquired the first portrait painted of the singer since the start of his professional career.
The four-foot square oil painting on linen was created by Belfast-based artist Colin Davidson after he met Sheeran's father, who is an art historian and curator, and the pair arranged a sitting.
Sheeran posed for Davidson for three hours at his home in Suffolk in August 2015, when Davidson made 20 drawings from life and took reference photographs to create the final portrait.
The finished product shows the singer wearing a dark top, looking thoughtfully off to the side of the frame.
The artist said : "When painting a portrait I am looking for the moment when the person is almost unaware of me being there and I feel I got it with Ed.
"I deliberately didn't want Ed to perform and that was odd for him. But there is a youthful aspect to the portrait but also something experienced beyond his years."
He added: "It has been a true privilege to get to know Ed and his family. It is my hope that this new portrait offers an alternative insight, one which allows the viewer to glimpse the source of Ed's unique creativity."
Davidson, who participated in the National Portrait Gallery's BP Portrait Award three times between 2011 and 2013, winning the BP Portrait Award Visitor's Choice Award in 2012,is best known for his larger-than-life portraits.
He said: "'They are all deliberately the same size; the idea is that everyone I paint is an equal and that format allows the face to become something else.
"If you see a painting of a face that is life-size, it never becomes anything else, it is a head. If it is smaller or bigger it can become something else."
He has painted another portrait of Sheeran, which is in a private collection.
Dr Nicholas Cullinan, director of the National Portrait Gallery, said: "I am very pleased that the National Portrait Gallery has been able to acquire this striking portrait of Ed Sheeran, who is undoubtedly one of today's most popular and influential musicians and singer-songwriters."