Sometimes he painted in his studio based on the sketches he drew outside.

(is this sentence grammatical? What is the sense subject of 'based'? What other sentences can we make which have the same meaning?)

The sentence needs some work.

The word "based" is a past participle, and it's being used here as an adjective, but there's nothing for it to describe!

Try this:

In his studio, he sometimes finished paintings that were based on the sketches he drew outside.

(And actually, I'd use "often" instead of "sometimes.)