Show more than three recent applications in Dock

I was looking for this myself. It took some digging and experimenting, but I figured it out.

You need to add two keys to your com.apple.dock.plist: show-recents and show-recent-count. Adding show-recent-count alone won't work, even if it's enabled in preferences.

defaults write com.apple.dock show-recents -bool true;
defaults write com.apple.dock show-recent-count -int 10;
killall Dock

And the results:

dock

Cheers!