It will bolt in okay, but that's about it. The engine wiring harness is different, and the sensor locations are different. I think it will also need a PCM out of a 2006 also. Further, you may still need to get it reprogrammed to work with the truck after the install too. There are some people here that have been in this situation and have had major headaches. Some people are still trying to make this work.
I would highly recommend getting an engine from a 2003 or 2004 if you can manage it at all. In 2005 (and continued till 2007), they changed a lot of things.
Some body else can probably tell you the specifics about what needs changing, but I know that it is not a drop-in replacement.