Finally the long wait for iOS 4.0 unlock is over as iPhone dev has released ultrasn0w 0.93 to unlock iOS 4.0 Baseband 05.13.04 on iPhone 3G & iPhone 3GS. Though ultrasn0w 0.93 can unlock iOS 4.0 with baseband 04.26.08 thru 05.13.04 only if you have jailbroken iPhone 3G/3GS 4.0.
Redsn0w 0.9.5 Beta 5 can jailbreak iOS 4.0 GM build but we are not sure whether we can jailbreak iOS 4.0 release today. In case you managed to jailbreak iOS 4.0 on iPhone 3G/3GS then follow below steps to unlock iOS 4.0 Baseband 05.13.04.
T-Mobile USA users must disable 3G before
How to Unlock iOS 4.0 Baseband 05.13.04 on iPhone 3G/3GS
1. Jailbreak iOS 4.0 using Redsn0w (should be released any time soon)
2. Now start Cydia and go to Manage section
3. Now click on sources and click on edit to add following repo
Repo666.ultrasn0w.com (it’s ‘0(zero)’ and not ‘o’)
4. Now search for Ultrasn0w 0.93 and click on install

5. Let Ultrasn0w 0.93 to complete unlocking
Mean while your iPhone will reboot, now enjoy your unlocked iPhone 3G/3GS 4.0 with your favorite carrier.