Filling gap between pipe and wall- creating a fire stop
Home improvement stores generally carry the correct caulking for a fire stop. It is Fire-Barrier caulk or Fire-Stop, it is usually color coded so the inspector will know you used the correct one.

Check building codes in your area to know which one to use most are rated for 4 hours. Be careful if you order it off the internet because if the color is wrong you fail, even if it meets the local code. 

For the gap there is also expanded foam that you can use, just make sure its rated and meets local codes.