The unnamed patient, who has a "serious mental health condition", learning disability and physical health problems, has been in a hospital bed for more than 1,338 days.
The patient is expected to leave hospital in "around six months", after arrangements were made for their care.
The hospital is part of the Hywel Dda University Health Board in west Wales.
Conservative AM Darren Millar said the delay was "truly scandalous".
Mr Millar, who represents Clwyd West, requested details of so-called "delayed discharge" in hospitals.
The response from the Welsh Health Secretary Vaughan Gething also revealed that, as of January this year, two other patients in Wales had been stuck in hospital beds for more than a year-and-a-half each.
Mr Millar said: "No patient should have to wait almost four years to be discharged from hospital.
"While bed blocking is extremely costly for the NHS in Wales, the real cost is the quality of life of patients for whom it affects."
Referring to the long-standing patient in his letter, Mr Gething wrote: "We have recently been advised that using a bespoke commissioning approach, the health board has secured a provider who is able to meet all of the patient's complex needs, subject to some structural alterations to their premises."
A spokesman for the Welsh Government said delayed transfers of care were at their lowest level for 12 years.
The NHS routinely collects figures on delayed discharge, which show the problem in England is getting worse.
The numbers of days lost to delays has nearly doubled since 2010 to 200,000 a month. The average cost of a hospital bed is Â£400 a day.
In January, the James Paget University Hospital in Norfolk applied for a court order to remove a patient who had refused to leave for more than two years.
And in February, a freedom of information request by the Scottish Liberal Democrats revealed one patient in Dumfries and Galloway remained in hospital for 508 days.
Get news from the BBC in your inbox, each weekday morning
A hospital patient has been waiting nearly four years to leave hospital after being declared fit for discharge.