Alexander Outland: Space Pirate, by G.J. Koch hits all the right notes. It has space battles, humor, gun battles, robots, pirates... yeah, it's good.
Alexander Outland is the captain of a small group of close-knit pirates. Think Firefly without the horses (oh wait, there were donkeys, never mind). Outland is a womanizer but has his heart set on one specific woman, and he can't keep her assets out of his thoughts. The book is told in first-person, from Outland's point-of-view, and his internal dialogue with himself is just as fun as his actual conversations with other characters.
Outland's crew on-board the Sixty-Nine (space vessel three three six nine) consists of a super-talented but somewhat dimwitted engineer and his sex-bot fiance that he built from a rare instruction manual, an elderly planetary governor that Outland's crew accidentally help depose, and the object of Outland's affections: his attractive weapons chief that wants nothing to do with Outland but always seems to end up on his lap.
The book opens with Outland deciding not to land on a planet where his exploits with some prominent local women are a little too well-known. Instead, he heads to what should be a safe haven but ends up in a battle with an invisible pirate armada that tries to capture him. Outland lives up to his reputation as the best pilot in the galaxy as he escapes and lands on the nearby planet the armada is blockading.
From there, Outland and his crew spend time trying to relax between bouts of being arrested, chased through the sewers, avoiding a stampede, meeting a telepathic spy, learning secrets about each other, picking up new crew members, and trying to defeat that pirate armada and save the galaxy all by themselves.
It's quite a ride. And it's a blast! My summary doesn't do the story justice - it's just. that. good. If you like science fiction with some humor, read this now.