When importing drugs in a country (even something apparently as innocuous as Ibuprofen), one should always check import regulations (and possibly rules for any transit countries as well, if applicable).
Sri Lanka's National Medecines Regulatory Agency says:
A person travelling to Sri Lanka can carry medicine for his personal use, without prior approval of the NMRA under the following conditions. The quantity of any single medicine required for the duration of his stay in Sri Lanka or the quantity required up to ninety days whichever is less. Prior approval of the NMRA should be obtain for quantities exceeding 90-day requirement.The medicine administered through intramuscular or intravenous route is not permitted. The medicine specified in Schedule III is not permitted. The medicine should be packed in the original container, if it is not in the original container, it should be appropriately labelled to identify the name and strength of the medicine with usage instructions. Medical records or prescription should be produced when necessary.
(emphasis mine).
So if you are coming for less than 90 days it should be fine to bring it with you, though a prescription would be useful. I couldn't find Schedule III but I would be surprised if Ibuprofen was listed there. However pay attention to the fact that some formulations may include other active ingredients such as Codeine which may be restricted.
If you plan to stay more than 90 days, then it also states on the same page:
Importing Medicines for PERSONAL USE
If a particular medicine required by a patient is not registered or not available in Sri Lanka, NMRA allows import of such a medicine through a personal user Letter of Authorization.
The general public can apply for a personal user license by logging into https://www.enmra.nmra.gov.lk furnishing required details or by handing over the documents directly to NMRA during working hours.
The following documents are required:
- Copy of a valid prescription issued by a registered medical Professional
- Request letter by the patient or a guardian of the patient
- Copy of the NIC/Passport /Driving license of the patient or the guardian
- Application form signed by the prescriber
A maximum of 100 doses can be imported by using the Personal User License.
No fee is charged by NMRA for this purpose
(emphasis mine)