Jailbreaks are really difficult to undo. You may have to sit and wait for Sony to push new firmware updates. Even then, traces of Jailbreak code may remain and can lead to perma-banning of your PSN account and console.
Safe bet? Wring enough money out of your "friend" for a new PS3.
Best bet is to take the HDD out of the PS3, use a SATA/USB enclosure to attach it to a PC and use a disk utilitly to wipe it clean (completely zero it - that is, write zeros to every single byte on the disk; this operation may take up to 18 to 24 hours to complete). Put it back in the PS3, let the PS3 reformat it, then install the firmware back on it.
Unfortunately, your "friend" might have cost you all your data, because I don't recommend backing up ANYTHING that is currently on the HDD. Save games MIGHT be safe, but I wouldn't count on it.
DO NOT JUST UPDATE! If your system is hacked it is possible for the PS3 to recognize it after updating. This will leave you without PSN access. You will need to download the official firmware from the PS home page to a USB drive then do a complete system restore of your system. Once it is done you will be asked for the official firmware on your USB device. Simply install that then you're good to go.