Credits for this method is not mine at all. I used a post from another XDA forum section made by user pinkolin.
Firstly, get Android SDK, since we'll be using the "adb" tool to upload the customized hosts file to your Android device.
Open Command Prompt and change dir to the dir you installed SDK to.
cd to "platform-tools" folder (adb.exe is there).
Next, get the latest hosts file here (right-click and "Save Link As" to the folder where adb.exe is):
Note: pinkolin's hosts file in his post was outdated so i used above source instead. This file is updated on January-13-2011.
On the phone, make sure you enabled USB Debugging (Settings > Applications > Development > Check USB Debugging).
Connect your phone to your PC.
Now, go back to Command Prompt and type the following commands (I recommend using copy-paste for them)
adb shell mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system adb push hosts.txt /etc/hosts adb shell mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system