Dear Linda,
I found exactly the same limit. I have posted a bug report here: https://tracker.moodle.org/browse/CONTRIB-4166
I don't know where the limit is set, nor how to get round it. For the time being, I am just splitting my main report into smaller units, which return less than 5,000 rows.