Hiya,
This is caused by one of four things.
In the fridge there is a dial to control the temperature of the fridge.
Behind the dial and the centre column is a mechanical thermostat and damper.
If this doesn't open, no cold air can come into the fridge.
Next time it doesn't cool, check this damper.
If it's closed you need to replace it.
If it's open, it would indicate either a blockage in the evaporator, circulation fan not running or a blockage in the ducting to the fridge.
Next time it doesn't cool the fridge, if the damper is open, take off the rear panel inside the freezer and see if the evaporator has frozen solid.
If it has, defrost it thoroughly and the fridge should work again.
If the evaporator is clear and the fan is running (stops when the door is opened) it would suggest you have problems with ice in the ducting to the fridge.
This would require a full defrost and dry out to rectify. 48 hours switched off with the doors open should achieve this.
Hope this helps
Let me know how it goes or if you need more help
Thanks
Home Appliance Technician
Whitegoods engineer working for a multibranded national company in the UK.