The Air Force began putting the space plane through its paces in 2010, with the first "Orbital Test Vehicle" (OTV) mission, which lasted 224 days. Each successive mission has lasted roughly 200 days longer than the previous flight, so the current mission, OTV-5, may stay in orbit for several more months. This trend of increasing endurance raises the question of why the Air Force needs a ship in orbit for what could turn out to be years at a time. The Daily Beast has reported that the X-37B is "designed to carry experimental payloads of sensors—like...high-tech cameras of various types, electronic sensors and ground-mapping radars." Its ability to easily land means the ship could hypothetically bring a spy satellite into orbit for a testing period, then safely return it to Earth for any adjustments.
The OTV missions are classified, so the official descriptions of what the ship is doing up there are unsurprisingly vague. According to the craft's public mission fact sheet, "The primary objectives of the X-37B are twofold; reusable spacecraft technologies for America's future in space and operating experiments which can be returned to, and examined, on Earth." We've also heard rumors that the project is a test for Hall-effect propulsion, which uses ions to produce thrust.