Does Newark (EWR) have a hotel actually in the airport?
Perhaps in Terminal B?
(Interestingly, I just could not find this information, despite knowing how to use a browser/google.)
Failing that, the best one for a Terminal B departure?
There's the Newark Marriott, which while not inside the airport is about as close as you can get. It's on the other side of the parking areas from the terminal as shown in the Google Maps image below. The $195 tag marks the hotel location across the parking lot from Terminal B.
They do have a shuttle to the airport, though on the couple of occasions I've stayed here before a very early morning departure, I've walked through the parking lot and across the road to and from the hotel. Note that this was very little traffic at the time. Crossing the road at other times and/or with a lot of luggage might not be recommended, it's not really a pedestrian friendly crossing.
Here's a close-up shot of the road between the parking lot and hotel.
There are other hotels close by with airport shuttle service, but this is the closest option I'm aware of. (And likely to be most expensive.)