It's generally preferable to stay in the park, mainly because the lodging is reasonable value and it's more convenient for the mountain and walking trails. However, there are midrange and budget places to stay outside the park, most on the road between the park headquarters and Kundasang (6km east of the park's main entrance), as well as in Kundasang proper.
Laban Rata (On The Mountain)
Camping is not allowed on the mountain, and thus access to the summit is limited by access to the huts on the mountain at Laban Rata (3272m); only 135 climbing permits are issued daily. Accommodation must be booked in advance, the earlier the better, because without prior accommodation booking, you may not climb. In order to have any hope of clear weather when you reach the summit you must arrive around dawn, and the only way to do this is by spending a night at Laban Rata.
Sutera Sanctuary Lodges in Kota Kinabalu operates almost all of the accommodation at Laban Rata, and space is limited. Bookings can be made online (easiest done via the Amazing Borneo website), in person or over the phone.
The most common sleeping option is the non-heated dormitory (bedding included) in the Laban Rata Resthouse, which costs RM1069 per person. If you need privacy, three heated twin shares are available for RM2000. Three meals are included in the price. Waras Hut acts as the dorm spillover.
The other option at Laban Rata is Pendant Hut, which is owned and operated by Mountain Torq. All guests sleeping at Pendant Hut take two of three meals at Sutera's cafeteria, and are required to participate in (or at least pay for) the via ferrata circuit. Pendant Hut is slightly more basic (there's no heat, though climbers sleep in uberwarm sleeping bags), but there's more chance of a last-minute space than at the Laban Rata Resthouse.
Park Headquarters (At the Base) & Around
Sleeping options located at the base of the mountain, operated by Sutera Sanctuary Lodges, range from spacious suites to bare-bones bunks. They're expensive compared to numerous sleeping spots just outside the park entrance and in the nearby village of Kundasang.