He cracked 10 fours in his 338-ball knock.
Australia batted cautiously in the morning to add 71 in 29 overs to their overnight total of 224/5, but improved their run-rate in the afternoon session which yielded 95 runs in 26 overs.
Johnson played an entertaining innings, hitting two sixes off Ojha and one off Harbhajan. He looked set to complete his fifth Test half-century before being caught behind off Zaheer. He also hit five fours in his 66-ball knock.
Paine, dropped on nought on Friday, played some attractive strokes after completing his half-century, hitting two successive fours off Ojha.
In Image: Australia's Shane Watson bats during the second day