Yes, there is a hotel right at the airport, the TAV Airport Hotel. Here is the link http://www.tavairporthotels.com.tr/default_eng.aspx
They have a "land" side and an "air" side. The air side allows you to stay in the international part of the airport. You don't have to go through passport control, get a visa, etc. You can use this side if both your flights are international. You can also rent a room by the hour. Somewhat expensive, but very convenient. One note - you can't get your checked luggage on this side, so you should be sure to have what you need in your carry on bags.
For the land side, you go through passport control and exit the airport. It's technically walking distance. They also run a 24-hour shuttle that I would recommend, especially when returning to the airport at 4:00 am.
I stayed in the land side about a year ago when I had a very early morning flight. The room was quite nice and I had a very good meal in the restaurant. If you stay on this side, ask for a room near the elevator because the hotel is really spread out, about two city blocks, and it saves a lot of time to be near the elevator! I don't know what the Air side is like, but it seems that the air side would be the side to stay on if you're just transferring flights.