My friend sold me his old iPhone because mine got stolen and he didn't need his any more. However, in order to unlock it so I can use my O2 sim, his network (3mobile) require the original receipt for the handset. He doesn't have it, so they refuse to unlock it. What are my options?
Three UK will provide unlocking for a device on payment of a fee. The requirement of the sales receipt may be their attempt at a fraud/theft prevention mechanism to make sure that stolen phones cannot be unlocked and reused.
If your friend purchased the device from 3 then he should be able to verify identity with them through payment history, and enable the route to unlocking the device.
When unlocked you will not receive and unlock code like some devices, instead the identity of the phone is passed to the Apple activation servers so then next time the device connects for activation it receives the unlock command.