The main share index closed 0.22 percent, or 12.73 points firmer, at 5,883.66, its highest close since Oct 3.
Foreign investors sold a net 239.15 million rupees ($1.89 million) worth of shares, extending the net outflow of foreign funds to 989.2 million rupees over four sessions and bringing the year-to-date foreign outflow of 354.1 million rupees.
Sri Lanka enjoyed a record foreign inflow of 38.63 billion rupees last year.
"The good thing is there is no panic in the market, though the foreign selling is continuing," a stockbroker said on condition of anonymity.
Foreign investors mainly sold top lender Commercial Bank of Ceylon, which ended 0.19 percent weaker at 104 rupees.
A fall in the yields of government securities boosted local buying after the 91-day t-bill yield fell to an 11-month low at a weekly auction on Tuesday.
Turnover on Wednesday was 1.27 billion rupees ($10.02 million).
The rupee closed weaker at 127.00/20 to the dollar from Tuesday's close of 126.75/85.
($1 = 126.7000 Sri Lanka rupees)
(Reporting by Ranga Sirilal and Shihar Aneez; Editing by Ron Popeski)