A lot of iPhone 3G had problems running iOS 4 on their iPhones.
You can go back to iPhone OS 3.1.3 (iOS 3.1.3) by downgrading. The steps are explained at MacLife.
Did you try it? How did it go? Make sure that you share your experience in the comments.
How To Downgrade your iPhone 3G to iOS 3.1.3 [Mac|Life].
Arabic version of this post on SaudiMac Arabic Edition.