Sri Lanka is not a miracle. Indian state of Kerala and Goa with similar population fair better than Sri Lanka in HDI and other living standard measures, infact Goa has higher per capita than Sri Lanka
Goa is tiny(2 million people) and is India's tourist destination for rich Westerners so of course it will have a high GDP/capita.
Remember that Sri Lanka has just come out of a 25 year civil war, without which it probably would have been up there with the likes of Malaysia as a middle-income country.