Late Night Arrival & Early Morning Departure
There are lounges at the airport; however, most of these airport lounges are strictly for the exclusive use of members' with particular affiliations (e.g., first class customers of particular airlines, exclusive club card members, etc.). Though, particular lounges may let the general public use them for a higher fee (for a certain # of hours), but some may not even operate in a 24/7 capacity. Never used these lounges myself, but I've seen them & heard about them there.
Read this info about lounges at the Lima airport:
"There are three VIP lounges operated by airlines and other organisations, the Peru VIP Lounge; the VIP Club Lounge for first-class passengers of specific airlines, and the Authorities Lounge. Diners cardholders may use the VIP lounges in the terminal." Source:
Check the website of Lima's airport for further info:
There's a hotel right at the airport's premises (Ramada Costa Del Sol), but since there's no competition in that location, prices may be steep. That may be a great option for overnight stays (late arrival & early am departure).
For a multitude of accommodation options in a great Lima area, check in Miraflores (most hotels/hostels will arrange a transportation service to/from airport). Check the VT travel guide for more info on this. Then again, re-evaluate if the few hours of running around is worth it to you.
If you find a hotel/hostel with steep rates (ie. $20 or more for a ONE WAY trip between Miraflores-airport) for transportation service, check my Lima "transportation" tip & e-mail the contact I wrote there. I've used the transportation service personally, and I've recommended several other VTers to him, and it has been a great experience so far with trust established.
If worse comes to worst, you can sleep in certain areas (ie. food court, chairs at transit/waiting areas). Just make sure to bring a small pillow/some sort of blanket to keep you warm in the meantime.
Good Luck & Enjoy Beautiful Peru!